[YBA] g++ newbie: No warn on missing method implementation?
Shachar Shemesh
shachar at shemesh.biz
Tue Jul 13 11:59:43 IDT 2010
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
--
Shachar Shemesh
Lingnu Open Source Consulting Ltd.
http://www.lingnu.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20100713/4e8a555a/attachment-0001.html>
More information about the Linux-il
mailing list