bug-gnulib
[Top][All Lists]
Advanced

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

Re: [Bug-gnulib] obstack uses casts as lvalues


From: Joseph S. Myers
Subject: Re: [Bug-gnulib] obstack uses casts as lvalues
Date: Tue, 21 Oct 2003 21:58:50 +0100 (BST)

On 21 Oct 2003, Paul Eggert wrote:

> I see a couple of other instances of lvalue casts, in the non-GCC part
> of obstack.h.  Weird.  Perhaps these macros are never really used?

If they are used, they can't ever have worked, but maybe they need to be
removed.  Only one of the various lvalue casts gets triggered at all in a
GCC bootstrap.  obstack could do with a testsuite that actually exercises
all the functions and macros and could be tested with both GCC and
non-GCC.

> What do you think of the idea of replacing (*((T *) p)++ = e) with
> (*(*(T **) &p)++ = e) instead?  That would be simpler than the
> patch you proposed, which replaced it with (*(T *) p = e, p += sizeof e).

I think that reinterpreting the bit pattern of p in this way as another
type of pointer would break the type-based aliasing rules.

-- 
Joseph S. Myers
address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]