cman wrote:
> What is the effective behaviour if you cast a memory address?
The same as if you cast anything, you coerce the compiler into assigning
a value to a pointer.
> I have
> come across code where memory address 0 is cast to a 'struct foo'
> type. What does this amount to? Does address 0 now point to address 0
> of the 'struct foo'?
>
Not a lot, you just end up with a foo* with a value of 0, or what ever
value you assigned to it. The example you posted was simply a dodgy way
to implement offsetof().
--
Ian Collins.
|