Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Confused with the "virtual base class" concept

Reply
Thread Tools

Confused with the "virtual base class" concept

 
 
Mike Bland
Guest
Posts: n/a
 
      09-03-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (Mike Bland) wrote in message news:<(E-Mail Removed). com>...
> So now I'm even more confused. The Sun compiler seems to be right on
> with this one, and GCC is oblivious, which is exactly backwards from
> what I might've expected.


Whoops, after looking at the GCC info page, I realized that what I
need to use is -Woverloaded-virtual. Wonder why it's not
automatically a part of -Wall.

Still, I'd be interested in knowing which compiler the OP was using.

Mike

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
 
Reply With Quote
 
 
 
 
mshetty
Guest
Posts: n/a
 
      09-08-2004
(E-Mail Removed) (Mike Bland) wrote in message news:<(E-Mail Removed). com>...
> (E-Mail Removed) (Mike Bland) wrote in message news:<(E-Mail Removed). com>...
> > So now I'm even more confused. The Sun compiler seems to be right on
> > with this one, and GCC is oblivious, which is exactly backwards from
> > what I might've expected.

>
> Whoops, after looking at the GCC info page, I realized that what I
> need to use is -Woverloaded-virtual. Wonder why it's not
> automatically a part of -Wall.
>
> Still, I'd be interested in knowing which compiler the OP was using.
>


Hi,

Details of the compiler and system I am using
Compiler : CC: Sun WorkShop 6 update 2 C++ 5.3 2001/05/15
OS : SunOS pcspsun3 5.7 Generic_106541-34 sun4u sparc SUNW,Ultra-5_10

Regards,
M Shetty

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
 
Reply With Quote
 
 
 
 
Old Wolf
Guest
Posts: n/a
 
      09-09-2004
(E-Mail Removed) (Mike Bland) wrote:
> (E-Mail Removed) (Mike Bland) wrote:
> > So now I'm even more confused. The Sun compiler seems to be right on
> > with this one, and GCC is oblivious, which is exactly backwards from
> > what I might've expected.

>
> Whoops, after looking at the GCC info page, I realized that what I
> need to use is -Woverloaded-virtual. Wonder why it's not
> automatically a part of -Wall.


No diagnostic is required by the Standard for the case of a function
hiding a base function (it's merely a quality-of-implementation issue).

Also -Wall is unfortunately-named, it should be -Wa-few-common-problems.
You should probably read the g++ documentation and add in lots more
-W settings to your Makefile.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
 
Reply With Quote
 
Mike Bland
Guest
Posts: n/a
 
      09-10-2004
(E-Mail Removed) (mshetty) wrote in message news:<(E-Mail Removed). com>...
> Details of the compiler and system I am using
> Compiler : CC: Sun WorkShop 6 update 2 C++ 5.3 2001/05/15
> OS : SunOS pcspsun3 5.7 Generic_106541-34 sun4u sparc SUNW,Ultra-5_10


Interesting. We're using the same Sun compiler, but I'm on patch
111685-20 dated 2004/03/19. You're using Solaris 7 and I'm on Solaris
8. Could be an issue with the compiler patchlevel, too. Try hitting
http://access1.sun.com/sundev/fdp6u2-patches.html to upgrade your
compiler patchlevel and see what happens.

Mike

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
 
Reply With Quote
 
Mike Bland
Guest
Posts: n/a
 
      09-10-2004
(E-Mail Removed) (Old Wolf) wrote in message news:<(E-Mail Removed). com>...
> No diagnostic is required by the Standard for the case of a function
> hiding a base function (it's merely a quality-of-implementation issue).


That's kinda surprising. Do you know if there are any plans to add
such a requirement?

> Also -Wall is unfortunately-named, it should be -Wa-few-common-problems.
> You should probably read the g++ documentation and add in lots more
> -W settings to your Makefile.


LOL That's how I realized, eventually, that -Wall didn't contain
-Woverloaded-virtual. I mean, I've known for a long time that -Wall
didn't really turn on *all* warnings, but I was quite suprised when I
looked at the info page after my initial posting and realized it
didn't include this one by default.

Incidentally, I use a "pedantic" script that precompiles our sources
with g++ with various warnings explicitly turned on before compiling
them with Sun CC. It's worked out quite well for shaking out all
sorts of nasty errors and warnings.

Mike

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sizeof(EmptyStruct) in C and C++ (was: Base {}; sizeof(Base) == 1?) Alex Vinokur C Programming 7 08-14-2006 04:57 PM
Format of compiler generated derived destructor when base has 'virtual ~base() throw():" qazmlp C++ 1 04-10-2005 03:09 PM
Virtual function 'BasicMidReader::~BasicMidReader()' conflicts with base class 'base 'TMemoryStream' tomek C++ 2 12-01-2003 06:31 AM
Virtual function 'BasicMidReader::~BasicMidReader()' conflicts with base class 'base 'TMemoryStream' tomek C++ 3 11-30-2003 12:18 AM
Virtual functions and virtual base classes - I'm confused Michael Winter C++ 9 09-23-2003 11:17 PM



Advertisments