Does it make anyy difference if a function is "inline"

This is a discussion on Does it make anyy difference if a function is "inline" within the C++ Programming forums, part of the General Programming Boards category; Well, does it?...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    160

    Does it make anyy difference if a function is "inline"

    Well, does it?
    Well english isn't my first language, (it's instead a useless language called danish which only 5 milion people speak!!) so if you think my grammar SUCKS (it does by the way) than you're more then welcome to correct me.
    Hell I might even learn something

  2. #2
    Cat
    Guest
    It helps in speed-critical procedures, sometimes. Essentially, IF your compiler actually makes the function inline (declaring it inline does NOT force the compiler to actually make it inline, it's more of a suggestion) you save a slight bit of time and memory by removing the overhead that goes with a procedure call.

    The only place you'd notice any difference would be in functions that are called repeatedly, and with machines getting faster and faster, instruction caches getting more intelligent and doing branch prediction, etc., the overhead to call a function is getting proportionally smaller and smaller.

  3. #3
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    inline does not only remove overhead to function calls, it also allows the compiler to make more sophisticated optimizations based on larger lengths of code generated by inlining a function.

  4. #4
    Registered User zdude's Avatar
    Join Date
    Sep 2002
    Posts
    32
    Just a question, what would happen with an inline recursive function?
    Those who live by the sword get shot by those who don't.

    I can C.

    Compiler: gcc

  5. #5
    Open to suggestions Brighteyes's Avatar
    Join Date
    Mar 2003
    Posts
    204
    p.s. What the alphabet would look like without q and r.

  6. #6
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    "Does it make anyy difference if a function is "inline""

    No, of course not. It's just a fancy trick to impress your friends.

  7. #7

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to make function return value go to structure record
    By Tom Bombadil in forum C Programming
    Replies: 1
    Last Post: 05-27-2009, 04:38 PM
  2. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 07:54 PM
  3. Change this program so it uses function??
    By stormfront in forum C Programming
    Replies: 8
    Last Post: 11-01-2005, 08:55 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  5. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21