On Feb 6, 2013, at 4:41 PM, Anna Zaks <[email protected]> wrote: >> $ cat t.mm >> #include <stdio.h> >> >> id foo(id x) { >> printf("%p\n", x); >> return x; >> } >> >> int main() { >> static id x = foo(x); >> } >> > > What are the semantics in this case? Would the value be uninitialized or 0? >
I believe the compiler zero-initializes 'x' before the initializer runs. That's why the call to foo() prints out 0x0. foo() could have returned a different pointer of course, and that is what gets stored to 'x' after running the initializer.
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
