tech-userlevel 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



2013-11-22 anthony.mallet%laas.fr@localhost wrote:
On Thursday, at 23:56, Mouse wrote:
| Yes, or at least wrong by that metric.  (The other 10% are things like
| casting to char * and copying as a sequence of bytes, which I think is
| exempted, though I don't recall details.

Yes, (char *)ptr is an explicitly allowed exception.

In gcq.h, I used (uint8_t *) instead of (char *) with offsetof and I see endian.h uses unit8_t to rearrange bytes. It makes more sense that way IMO, but it sounds like it actually violates strict aliasing while using char wouldn't. Does anyone with more in depth understanding know if this is this case?

-Matt


C99:
``An object shall have its stored value accessed only by an lvalue expression
that has one of the following types:

- a type compatible with the effective type of the object,
- a qualified version of a type compatible with the effective type of the 
object,
- a type that is the signed or unsigned type corresponding to the effective
  type of the object,
- a type that is the signed or unsigned type corresponding to a qualified
  version of the effective type of the object,
- an aggregate or union type that includes one of the aforementioned types
  among its members (including, recursively, a member of a subaggregate or
  contained union), or
- a character type. ''



Home | Main Index | Thread Index | Old Index