[cfe-commits] r130453 - in /cfe/trunk: lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CGExprCXX.cpp test/CodeGenCXX/value-init.cpp
Chris Lattner
clattner at apple.com
Thu Apr 28 16:36:42 PDT 2011
On Apr 28, 2011, at 3:57 PM, Argyrios Kyrtzidis wrote:
> Author: akirtzidis
> Date: Thu Apr 28 17:57:55 2011
> New Revision: 130453
>
> URL: http://llvm.org/viewvc/llvm-project?rev=130453&view=rev
> Log:
> Cut down unnecessary zero'ing when value-initializing arrays of C++ objects.
>
> -C++ objects with user-declared constructor don't need zero'ing.
Are you sure that this is true? Apparently the C++ standard requires that global variables (at least) are zero initialized and that constructors can take advantage of this. This is apparently well defined:
struct foo {
int x;
foo() {
++x;
}
} f;
I'm pretty sure that this doesn't apply to temporaries etc, but it would be worth checking if you haven't already.
-Chris
More information about the cfe-commits
mailing list