On Feb 6, 2013, at 3:27 PM, Ted Kremenek <[email protected]> wrote:

> On Feb 6, 2013, at 3:24 PM, Ted Kremenek <[email protected]> wrote:
> 
>> Put another way, this patch seems to rely on the value of a variable being 
>> "uninitialized" to indicate whether or not the initializer has been 
>> executed.  That's not a valid assumption.  For example:
>> 
>>   static id x = foo(x);
>> 
>> is "okay" in Objective-C.
> 
> … or rather Objective-C++.
> 
> $ 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?

> $ clang++ t.mm
> $ ./a.out
> 0x0

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to