outline

Discussion in 'C++' started by Agent Mulder, Jul 29, 2003.

  1. Agent Mulder

    Agent Mulder Guest

    I feel the need for an outline specifier to
    facilitate java-style programming.
    Agent Mulder, Jul 29, 2003
    #1
    1. Advertising

  2. "Agent Mulder" <> wrote...
    > I feel the need for an outline specifier to
    > facilitate java-style programming.


    There is no need in the language to do anything to emulate
    any other language. What problem, otherwise unsolvable,
    will 'outline' solve? If you can answer this question, post
    your suggestion, with the justification, to comp.std.c++.

    Victor
    Victor Bazarov, Jul 29, 2003
    #2
    1. Advertising

  3. Agent Mulder wrote:
    > I feel the need for an outline specifier to
    > facilitate java-style programming.
    > ...


    Don't you think that C++ already suffered enough from "java-style
    programming"? And that without even trying to facilitate it explicitly.

    --
    Best regards,
    Andrey Tarasevich
    Brainbench C and C++ Programming MVP
    Andrey Tarasevich, Jul 30, 2003
    #3
  4. Agent Mulder

    Agent Mulder Guest

    AM> I feel the need for an outline specifier to
    AM> facilitate java-style programming.

    VB> There is no need in the language to do anything to emulate
    VB> any other language. What problem, otherwise unsolvable,
    VB> will 'outline' solve? If you can answer this question, post
    VB> your suggestion, with the justification, to comp.std.c++.

    With java-style programming I mean that you
    do away with the .cpp .h - pair of files. All
    function definitions go directly in the class
    declaration. The compiler honors this attempt
    and generates very fast, yet big applications.
    In order to slow my program down, I need some
    functions to be expanded 'outline'


    class Music
    {
    public:void init()
    {
    //1400 lines of initialization code (skipped)
    for(;;); //this forces my compiler to *NOT* inline this function
    }};


    This leaves me with a warning message:
    Warning W8027: Functions containing for are not expanded inline
    I wave my hat and shout back "Never Mind!". But why not write
    it like this:



    class Music
    {
    public:eek:utline void init()
    {
    //1400 lines of initialization code (skipped)
    }};


    to make sure the compiler takes it out of the class
    definition while leaving the structure of the class intact.

    -X
    Agent Mulder, Jul 30, 2003
    #4
  5. "Agent Mulder" <> wrote:
    > I feel the need for an outline specifier to
    > facilitate java-style programming.


    Many compilers allow you to disable inlining of functions completely.
    There is a discussion going on in comp.lang.c++.moderated (turn off
    inlining using extern "C") exactly about the same subject, you might
    want to join in there. I doubt that facilitating java-style programming
    will convince many, however.

    Just to satisfy my curiosity (not intended as criticism); if you prefer
    Java style programming, why you don't just use Java? I think one of the
    most important problems of Java programmers struggling to learn C++, is
    realizing that C++ is really a different programming language with
    different semantics and idioms, even though much of the syntax may seem
    quite familiar at first. Encouraging to make C++ look more like Java
    doesn't really help in this respect in my opinion

    --
    Peter van Merkerk
    peter.van.merkerk(at)dse.nl
    Peter van Merkerk, Jul 30, 2003
    #5
  6. "Agent Mulder" <> wrote...
    > VB> Whatever.
    >
    >
    > That's not enough. [...]


    Not enough for what? I don't want to continue this
    discussion.
    Victor Bazarov, Jul 31, 2003
    #6
  7. Agent Mulder

    Agent Mulder Guest

    VB>I don't want to continue this discussion.


    Why not? I only want you to notice
    that I posted my suggestion for
    'outline' on July 29, 2003 and the
    suggestion for !inline by Francis
    Glassborrow is from July 31, 2003.
    Today! Only 2 hours ago, the e-ink
    has not yet dried...

    -X

    go expand a macro, or backtrace something...
    Agent Mulder, Jul 31, 2003
    #7
  8. Agent Mulder wrote:
    >
    > VB>I don't want to continue this discussion.
    >
    > Why not?


    I think Victor has the same feeling on this 'feature'
    as I have:
    It's pointless.
    If I don't want a function to be inlined, well, then
    simply don't write the function body in the class
    decleration. Plain and simple. No special keyword
    needed for that.

    --
    Karl Heinz Buchegger
    Karl Heinz Buchegger, Aug 1, 2003
    #8
  9. Agent Mulder

    Agent Mulder Guest

    KHB> I think Victor has the same feeling on this 'feature'
    KHB> as I have:
    KHB> It's pointless.
    KHB> If I don't want a function to be inlined, well, then
    KHB> simply don't write the function body in the class
    KHB> decleration. Plain and simple. No special keyword
    KHB> needed for that.

    Modern compilers and linkers are smart enough
    that they will inline everything they see fit, defined
    inside or out of the class body. You can't trust on
    that.

    -X
    Agent Mulder, Aug 1, 2003
    #9
  10. Agent Mulder wrote:
    >
    > KHB> I think Victor has the same feeling on this 'feature'
    > KHB> as I have:
    > KHB> It's pointless.
    > KHB> If I don't want a function to be inlined, well, then
    > KHB> simply don't write the function body in the class
    > KHB> decleration. Plain and simple. No special keyword
    > KHB> needed for that.
    >
    > Modern compilers and linkers are smart enough
    > that they will inline everything they see fit, defined
    > inside or out of the class body. You can't trust on
    > that.
    >


    If the compiler deosn't see the source code,
    it cannot inline it, simple.

    But for the linker:
    Do you know of any linker that does this?
    I would be very surprised and make a deep bow
    in front of the guys who managed to do that.

    --
    Karl Heinz Buchegger
    Karl Heinz Buchegger, Aug 1, 2003
    #10
  11. Agent Mulder

    Agent Mulder Guest

    AM > I feel the need for an outline specifier [...]

    KHB> If I don't want a function to be inlined, well, then
    KHB> simply don't write the function body in the class
    KHB> decleration. Plain and simple. No special keyword
    KHB> needed for that.

    AM> Modern compilers and linkers are smart enough
    AM> that they will inline everything they see fit, defined
    AM> inside or out of the class body.

    KH> If the compiler deosn't see the source code,
    KH> it cannot inline it, simple.
    KH>
    KH> But for the linker:
    KH> Do you know of any linker that does this?
    KH> I would be very surprised and make a deep bow
    KH> in front of the guys who managed to do that.

    I copied this reply from from the thread
    Re: turn off inlining using extern "C", on
    comp.lang.c++.moderated:

    Heinz Ozwirk:
    >If you want to prevent functions from being inlined, put them in separate
    >.cpp (or whatever) files and only include their prototypes in the code
    >that calls them. The compiler cannot inline them, if it doesn't know what
    >to inline.


    Francis GlassBorow:
    Of course it can and good linkers have been managing that for some time.
    In future it will become more common as forms of semi-compiled code
    become more common. VC++7 has some quite clever features in this area.

    //Agent Mulder again:
    The conclusion in that thread is that there is no
    portable way to ensure that code gets expanded
    outline (not inline). It is viewed as a de-optimization
    enforced by the programmer. Your hack of taking
    the function body out of the class declaration does
    not work. Fix it.

    -X
    Agent Mulder, Aug 1, 2003
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. msnews.microsoft.com

    Document Outline in VS.NET! WOW!

    msnews.microsoft.com, Jul 25, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    1,689
    msnews.microsoft.com
    Jul 26, 2004
  2. King of Red Lions

    Text outline

    King of Red Lions, Apr 8, 2004, in forum: HTML
    Replies:
    9
    Views:
    20,511
    mikewandling
    Oct 25, 2008
  3. Kate
    Replies:
    5
    Views:
    4,980
  4. Matej Cepl
    Replies:
    8
    Views:
    504
    Matej Cepl
    Dec 6, 2004
  5. Agent Mulder

    unline instead of outline

    Agent Mulder, Aug 3, 2003, in forum: C++
    Replies:
    14
    Views:
    590
    Peter van Merkerk
    Aug 6, 2003
Loading...

Share This Page