Hi Shachar,
Right, right.
I also think that the VS2008 is doing something "extra".
My problem is that I have a class with 70+ methods and the customer keeps
changing the specs. I need some way to verify that all of the methods
declared in the class have implementations. The most common mistake is
that I change the method name in the class but forget to change the name
in the implementation. I suppose that I could write a Perl script that
would automatically generate method calls from the class method
declarations and then watch for link errors.
Regards,
- yba
On Tue, 13 Jul 2010, Shachar Shemesh wrote:
Date: Tue, 13 Jul 2010 11:59:43 +0300
From: Shachar Shemesh <[email protected]>
To: Jonathan Ben Avraham <[email protected]>
Cc: ILUG <[email protected]>
Subject: Re: [YBA] g++ newbie: No warn on missing method implementation?
Jonathan Ben Avraham wrote:
Dear linux-il list,
g++ seems to be quite happy to compile and link a program that has a
class that
includes method declarations that are not implemented, as log as those
methods are not
called explicitly in the code. VS2008 seems to be able to discover this,
either at
compile or link time. Any way to do this in g++?
Thanks,
- yba
I'm not sure the VS2008 behavior is the standard. Declaring a method in a class
and not defining it
is the same "offense" as declaring a function and not defining it, both from
the technical and from
the conceptual perspective.
More to the point - I'm not aware of such a flag for g++. I'm not sure where
such a flag should
even come, as the compiler should never be the one to do it (how will it know
it is not defined in
some other compilation unit?), and the linker cannot (how does it know a
function was defined if
noone was using it?).
Shachar
--
EE 77 7F 30 4A 64 2E C5 83 5F E7 49 A6 82 29 BA ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- [email protected] - tel: +972.2.679.5364, http://www.tkos.co.il -_______________________________________________
Linux-il mailing list
[email protected]
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il