inline - push_back

S

sks_cpp

I want to inline a function operator (part of a functor class) that does a
push_back on a list container.
Would the compiler inline this method or not? How can I tell?

Since the method "push_back" can throw an exception, does that make a
difference as to how the compiler determines if the function is inline'able
or not?

Thanks.
 
J

Jack Klein

I want to inline a function operator (part of a functor class) that does a
push_back on a list container.
Would the compiler inline this method or not? How can I tell?

Don't know. The "inline" keyword is a hint to the compiler. It may
or may not expand a function in line if you define it with the
"inline" keyword. It may or may not expand a function in line even if
you don't define it with the "inline" keyword. It is completely
compiler specific.

As to how you can tell whether or not a particular function was
actually expanded in line, that's also compiler specific.
Since the method "push_back" can throw an exception, does that make a
difference as to how the compiler determines if the function is inline'able
or not?

Thanks.

All issues about whether or not a compiler decides to expand a
specific compiler in line are compiler specific. The only place you
can get answers to these questions is in a support group for that
specific compiler. And then they would not necessarily apply to other
compilers, a different version or your compiler, or even your compiler
with different options.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
 
R

Ryan

sks_cpp said:
I want to inline a function operator (part of a functor class) that does a
push_back on a list container.
Would the compiler inline this method or not? How can I tell?

Since the method "push_back" can throw an exception, does that make a
difference as to how the compiler determines if the function is inline'able
or not?

Thanks.

On a practical note, if you define the function within your class
definition it will likely be inlined. You can *probably* grep your
compiler's symbol map output file to see if it was inlined (not
finding it in the file means it's probably inlined).

Further details can probably be found in your compiler documentation.

Dunno anything about exception throwing effects on inlineing.

Ryan
 

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,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top