uninitialized member warnings ?

Michael Meeks michael.meeks at suse.com
Thu Sep 27 03:21:28 PDT 2012


On Wed, 2012-09-26 at 15:29 +0200, Lubos Lunak wrote:
>  I don't think it can go anywhere practical:

	:-) while it's certainly possibly to find cases where it is hard to
detect and warn about these problems, I imagine that catching many of
the banal cases and warning about those would be reasonably do-able -
while punting on the false positives.

> class A
> {
> bool foo;
> void init();
> public:
> A() { init(); }
> };
> 
>  How should the compiler know?

	In this case; it should be clever ;-) we could defer the checking until
we compiled the init function: but of course, this soon gets pretty
intense cost-wise, and (absent LTO-scale visibility of all the code)
can't be perfect.

	Warnings for constructors that don't call member functions, don't
initialise POD types, and/or don't pass references to them elsewhere
would surely be a useful if not complete win.

	ATB,

		Michael.

-- 
michael.meeks at suse.com  <><, Pseudo Engineer, itinerant idiot



More information about the LibreOffice mailing list