tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: in which we present an ugly hack to make sys/queue.h CIRCLEQ work



> (I think that) strict aliasing rules implies that if two types
> "type{1,2}" do not match any of the aliasing rules (e.g. type1 is of
> the same type as the first member of type2, or type1 is a char, or
> ...), then any two pointers ptr{1,2} on type{1,2} respectively _ARE_
> different, because *ptr1 != *ptr2 per the aliasing rules and this
> implies ptr1 != ptr2.

Only if you actually evaluate *ptr1 and *ptr2 (in some cases, I think,
just one of them is enough).  Otherwise you're not accessing the
relevant object(s); the rule is about accesses to values, not about
pointers that, if followed, would perform certain accesses to values.

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML                mouse%rodents-montreal.org@localhost
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index