can I safely ignore inline ?

T

toton

Hi,
Can I safely ignore the inline keyword without thinking of
performance ?
I need some better organization of my files, and need to shift some
of my inlined functions to cpp file.
I have to remove inline if I do that.
Most of my inlined functions at present are one liners which returns
a field (kind of getters ).

Thanks
abir
 
P

peter koch

toton skrev:
Hi,
Can I safely ignore the inline keyword without thinking of
performance ? Perhaps.
I need some better organization of my files, and need to shift some
of my inlined functions to cpp file.
Why? I do not see the connection.
I have to remove inline if I do that. Again: why?
Most of my inlined functions at present are one liners which returns
a field (kind of getters ).
Most probably you will not see a difference. If you do, its time to
profile and change your code based on the result.

/Peter
 
R

Ron Natalie

toton said:
Hi,
Can I safely ignore the inline keyword without thinking of
performance ?
I need some better organization of my files, and need to shift some
of my inlined functions to cpp file.
I have to remove inline if I do that.
Most of my inlined functions at present are one liners which returns
a field (kind of getters ).
Almost.

Inline does two things.

1. It gives the compiler a hint that performance might be increased by
inlining this function.

2. (THIS IS WHAT YOU MUST NOTICE) It allows the function to be
multiply defined yet identically defined without error.
 
C

Charlie

Hi,
Can I safely ignore the inline keyword without thinking of
performance ?
I need some better organization of my files, and need to shift some
of my inlined functions to cpp file.
I have to remove inline if I do that.
Most of my inlined functions at present are one liners which returns
a field (kind of getters ).

Thanks
abir

Depends on the compiler, really. Most compilers ignore 'inline'
completely and others consider it a suggestion. Just because it is
there doesn't mean the compiler is actually going to do it. With the
newer compilers it is better to just let them decide anyway since they
know best. :)
 

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
474,184
Messages
2,570,979
Members
47,579
Latest member
CharaS3188

Latest Threads

Top