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

>On Wed, Nov 20, 2013 at 07:01:15PM -0500, Ken Hornstein wrote:
> > #define TAILQ_PREV(elm, headname, field)                                \
> >         (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
>There's another wrinkle, however, which is that this code (TAILQ_PREV)
>also violates the strict-aliasing rules. I don't think anyone has
>found a clear case of gcc (4.8 or otherwise) tripping on it yet, but
>it too really ought to be fixed before it bites someone.

I'll be the first one to admit that the strict-aliasing rules are just
at the limit of my understanding ... but doesn't that depend on how
you use it?  You'd have to be using it in a case where it mattered if
it could be the same as another pointer.  Okay, I can imagine that
wouldn't be too hard to get into that situation, but it's not in the
same class as the CIRCLEQ macros where the violation of strict-aliasing
rules is directly in the macros themselves.


Home | Main Index | Thread Index | Old Index