473,397 Members | 1,961 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,397 software developers and data experts.

weird compiler warning

I'm compiling some code on a IRIX compiler (MIPSpro Compilers: Version
7.4.2m) with all warnings turned on, and I'm getting some of these warnings:
cc-3649 CC: ERROR at end of source
all virtual functions for class "std::__Named_exception" inline: static
virtual table generated
cc-3649 CC: ERROR at end of source
all virtual functions for class "std::logic_error" inline: static virtual
table generated

Anyone have any idea what the heck it means and why it's a problem?

Thanks,
Joe
Aug 2 '06 #1
3 1896
Joe Van Dyk wrote:
I'm compiling some code on a IRIX compiler (MIPSpro Compilers: Version
7.4.2m) with all warnings turned on, and I'm getting some of these warnings:
cc-3649 CC: ERROR at end of source
all virtual functions for class "std::__Named_exception" inline: static
virtual table generated
cc-3649 CC: ERROR at end of source
all virtual functions for class "std::logic_error" inline: static virtual
table generated

Anyone have any idea what the heck it means and why it's a problem?

Thanks,
Joe
Many compilers implement virtual functions as follows (note, this is
not required by the standard, but is just a common implementation):

For each class that has virtual functions, create a table (called
vtable or "virtual table") of pointers to all virtual functions. Add
to the class an additional member that is a pointer to this table.
When dispatching a function virtually, follow the pointer to find the
vtable, find the appropriate function pointer in the vtable, call the
function.

Now, this works well in practice, except for the detail that the
compiler must find some place to actually put this table. A common
heuristic is to put it in the compilation unit that contains the
definition of the class's first non-inline virtual function. Obviously
this doesn't work if there are no non-inline virtual functions, as in
your case.

Faced with this situation, some compilers will use other smart tricks,
and others will generate a separate copy of the vtable in every
compilation in which the class is used, which may possibly increase the
runtime size of your program considerably. My guess is that your
compiler chooses this latter route, and is warning you about it.

The obvious solution is to not have any classes in which all virtual
functions are inlined. Such a concept is rarely useful anyway. A call
to a virtual function can only be inlined if the static type is known,
in which case why did you make the function virtual?

--
Alan Johnson

Aug 3 '06 #2

"Alan Johnson" <aw***@yahoo.comskrev i meddelandet
news:11*********************@i3g2000cwc.googlegrou ps.com...
Joe Van Dyk wrote:
>I'm compiling some code on a IRIX compiler (MIPSpro Compilers:
Version
7.4.2m) with all warnings turned on, and I'm getting some of these
warnings:
cc-3649 CC: ERROR at end of source
all virtual functions for class "std::__Named_exception" inline:
static
virtual table generated
cc-3649 CC: ERROR at end of source
all virtual functions for class "std::logic_error" inline:
static virtual
table generated

The obvious solution is to not have any classes in which all virtual
functions are inlined. Such a concept is rarely useful anyway. A
call
to a virtual function can only be inlined if the static type is
known,
It might be known in some contexts, but not in others. Sometimes you
use an object directly, sometimes through a pointer or reference.
in which case why did you make the function virtual?
He didn't.

It's part of the standard library. .-)
Bo Persson
Aug 3 '06 #3
On Thu, 03 Aug 2006 19:54:21 +0200, Bo Persson wrote:
>
"Alan Johnson" <aw***@yahoo.comskrev i meddelandet
news:11*********************@i3g2000cwc.googlegrou ps.com...
>Joe Van Dyk wrote:
>>I'm compiling some code on a IRIX compiler (MIPSpro Compilers:
Version
7.4.2m) with all warnings turned on, and I'm getting some of these
warnings:
cc-3649 CC: ERROR at end of source
all virtual functions for class "std::__Named_exception" inline:
static
virtual table generated
cc-3649 CC: ERROR at end of source
all virtual functions for class "std::logic_error" inline:
static virtual
table generated

>The obvious solution is to not have any classes in which all virtual
functions are inlined. Such a concept is rarely useful anyway. A
call
to a virtual function can only be inlined if the static type is
known,

It might be known in some contexts, but not in others. Sometimes you
use an object directly, sometimes through a pointer or reference.
>in which case why did you make the function virtual?

He didn't.

It's part of the standard library. .-)
Yes, so this warning is frustrating me. I don't see a way to turn off
that particular warning either.

Joe

Aug 3 '06 #4

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

Similar topics

14
by: Bo | last post by:
When I had this code, a and b's value never increases. for( int i=0, double a=0.0, double b=0.0 ; i<100; a+=0.1, b+=0.2 ) { printf( "%s\n", i+a+b ); } This works, however: double a=0.0,...
1
by: amit | last post by:
I am trying to compile the sample program genwin.sqc, using nsqlprep which is used to precompile embedded sql in C. I am getting weird errors and that is because windows.h is included in the...
1
by: Hafeez | last post by:
I am having real trouble compiling this code http://www.cs.wisc.edu/~vganti/birchcode/codeHier/AttrProj.tgz The attachment shows errors when compiled using the current version of g++ in a...
11
by: Ross | last post by:
I'm compiling some code over and over with no problems. The only differences between the versions is slightly different constants that are specific to various embedded devices that are getting...
8
by: Daniel Yelland | last post by:
Hi, I have developed a number of code libraries in Win32 DLLs and have written a number of test suite executables that implicitly link to these libraries in order to test them. In one of my test...
1
by: Josué Andrade Gomes | last post by:
Take this code: 1: int main() 2: { 3: unsigned short x = { 1, 2, 3, 4, 5 }; 4: unsigned short sum = 0; 5: 6: for (int i = 0; i < 5; ++i) { 7: sum += x; 8: } 9: }
13
by: Sam Steingold | last post by:
the following program does not compile with g++ 4.1.1: ==================================================== // $Id$ // $Source$ #include <stdint.h> #include <stdio.h> typedef struct {...
14
by: WStoreyII | last post by:
the following code is supposed to read a whole line upto a new line char from a file. however it does not work. it is producing weird results. please help. I had error checking in there for...
2
by: greg | last post by:
In my quest to eliminate C compiler warnings from Pyrex output, I've discovered some utterly bizarre behaviour from gcc 3.3. The following code: void g(struct foo *x) { } void f(void) {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.