[cfe-dev] warn when ctor-initializer leaves uninitialized data?

John N. Lehner lehner at cs.stanford.edu
Tue Apr 10 08:38:01 PDT 2012


Another case where the warning might not be desired is if a class overloads operator new and initializes its allocation itself?

On Apr 9, 2012, at 4:26 PM, Evan Wallace wrote:

> On Mon, Apr 9, 2012 at 3:54 PM, Jordan Rose <jediknil at belkadan.com> wrote:
> I like this idea, though like David said it might not be great for all projects. I think it should be off for POD structs, though, like your first example:
> 
> > // warning about a
> > struct A { int a; };
> 
> I think fewer people mistakenly expect POD structs to be initialized, and of course initializing 'a' would make the struct no-longer POD. The issues I've come across while working with Clang are always POD members in non-POD structures. What do you think?
> 
> That makes a lot of sense, especially for compiling C-like code. I like that much better. I've updated my patch with test cases and a check for POD types. I'm still not sure where to put this diagnostic. It's tentatively in a new warning called -Wuninitialized-member in the -Wextra group. Is that the best place for it, or would it fit better somewhere else?
> 
> - Evan
> <Wuninitialized-member.diff>_______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120410/ed3b4056/attachment.html>


More information about the cfe-dev mailing list