473,395 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

inline - push_back

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.
Jul 19 '05 #1
2 2517
On Thu, 03 Jul 2003 17:10:56 GMT, "sks_cpp" <sk*****@hotmail.com>
wrote in comp.lang.c++:
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
Jul 19 '05 #2
"sks_cpp" <sk*****@hotmail.com> wrote in message news:<As*********************@news2.central.cox.ne t>...
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
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Balbir Singh | last post by:
I was wondering if a function pointer pointing to an inline function, will actually expand "inline" when the function pointer is invoked. #include <iostream> #include <vector> using...
6
by: Mattias Brändström | last post by:
Hello all! I am trying to write code that allows me to initialise one of my classes inline (with a vector like structure). Inline might not be the best term to use here but I can't think of any...
4
by: sam | last post by:
Hi, I can't figure out what is the problem of the following coding. #ifndef __PARSER__ #define __PARSER__ #include <iostream> #include <string> #include <fstream> //#include <exception>
9
by: Jeff | last post by:
Hello- Ive never used a vector or vectors in C++ so I have a question for you all. I know I can dynamically create the size I need upfront, but is it possible to create them on the fly...
11
by: PengYu.UT | last post by:
The following program calls the normal constructor and the copy constructor. By calling the copy constuctor is redundandant, all I want is only a vector of a trial object. Is there any way to...
5
by: =?Utf-8?B?TWljayBPJydOZWlsbA==?= | last post by:
I asked about this a few days ago, and not found an aswer yet, but I have tracked down further info. I am getting the problems occrrung with the stl, under thses sorts of circumstances: #include...
6
by: Siam | last post by:
Hi, I'm a little new to stl so bear with me...Say I have the following code: vector<intvec; int i = 3; vec.push_back(i); i=4; cout<<vec.at(0)<<endl;
6
by: jmsanchezdiaz | last post by:
CPP question: if i had a struct like "struct str { int a; int b };" and a vector "std::vector < str test;" and wanted to push_back a struct, would i have to define the struct, fill it, and then...
12
by: jabbah | last post by:
Hi, I just found, that code that ran under Visual Studio 8 doesnt run under 9 anymore and now im seeking confirmation of whether my code is unsafe and just accidentially worked or what one can expect...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.