Results 1 to 9 of 9

Thread: Is this a inline ?

  1. #1

    Thread Starter
    Lively Member slx47's Avatar
    Join Date
    Apr 2002
    Location
    US
    Posts
    127

    Is this a inline ?

    class functions
    {
    int addnum(int x,int y) {return (x - y)};

    }

    is the last part of addnum function inline ?

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Yes since you've given it a definition. However, you should give it the inline keyword as well (inline int addnum(...) { ... }).
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    arent all functions that are in classes inline by default?
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    No, only those that have the definition inside the class body and those that have the explicit inline keyword in the definition.

    Parksie: inline inside a class?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Huh?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I mean, I've never heard of the keyword inline being used inside the class declaration.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I thought it was supposed to be given for anything that you wanted the compiler to inline.

    Not that VC++ takes any notice of the inline keyword, and many other compilers probably ignore it as well.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  8. #8
    amac
    Guest
    It says in "The A.R.M." ( The Annotated C++ Reference Manual ) that methods defined inside the class declaration are equivalent to a method which uses the inline keyword.

    I guess my point is that it is not just a VC++ thing.

  9. #9
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I think the ARM predates the C++ Standard.


    Either way, a superfluous inline doesn't hurt and makes it easy for the reader
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width