Andreas Krebbel writes:
 > 
 > > struct foo { int n; };
 > > extern unsigned long c = 0;
 > > 
 > > {
 > >   int b;
 > > 
 > >   b = 2;
 > >   ((struct foo*)(&b + c))->n = 3;
 > > }
 > 
 > For having a true dependency the example should look like this:
 > 
 > struct foo { int n; };
 > extern unsigned long c = 0;
 > 
 > {
 >   int b;
 >   int d;
 > 
 >   b = 2;
 >   d = ((struct foo*)(&b + c))->n;
 > }

6.7.2.1:  A pointer to a struct object, suitably converted, points to
its initial member, and vice versa.

However, that doesn't imply that you can convert a pointer to an
arbitrary scalar to a pointer to a structure whose initial member has
the same type as the scalar.

Andrew.

Reply via email to