inline functions

S

sunil

Hello,
Does member function inlining in C++ guarantee that multiple files
including a header (that includes implementation for function member
thats inlined) wont get multiply defined linker errors even if
compiler decides NOT to inline the function?
I experimented this in a sunOS machine forcing compiler not to inline
a function, and the scope of functions is LOCL (i.e. its not visible
to other modules) and so I dont get linktime errors . Does C++
standard define this as behavior?
Thanks
 
B

Bo Persson

sunil said:
Hello,
Does member function inlining in C++ guarantee that multiple files
including a header (that includes implementation for function member
thats inlined) wont get multiply defined linker errors even if
compiler decides NOT to inline the function?
I experimented this in a sunOS machine forcing compiler not to
inline a function, and the scope of functions is LOCL (i.e. its not
visible to other modules) and so I dont get linktime errors . Does
C++ standard define this as behavior?
Thanks

Yes, it does.


Bo Persson
 
J

Juha Nieminen

sunil said:
Does member function inlining in C++ guarantee that multiple files
including a header (that includes implementation for function member
thats inlined) wont get multiply defined linker errors even if
compiler decides NOT to inline the function?

Think about it the other way around: Would it make any sense if inline
functions would be treated as regular functions, causing linker errors?
That would make inline functions rather useless, and not only useless,
but something to avoid like a plague. The whole concept would have no
reason to exist.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top