If you look at this code (from the link above), the fact that an optimizer is allowed to make such modifications looks pretty annoying, and honestly, looks like a result of wishful thinking regarding the evolution of c++ language and what it eventually may become.
Code: Select all
#define __attribute__(x) // Invalidates all __attribute__ declarations
typedef long __attribute__((__may_alias__)) t_long;
int main (void){
int i = 42;
t_long *pa = (t_long *) &i;
*pa = 0;
if (i == 42)
return 1;
return 0;
}
What do you think?