This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: generalized lvalues -- patch outline
Paul Koning <pkoning@equallogic.com> writes:
>>>>>> "Eric" == Eric Botcazou <ebotcazou@libertysurf.fr> writes:
>
> >> The average C programmer would not have thought to use this
> >> extension unless they just decided one day to try it or they
> >> actually read the gcc documentation (which I know almost nobody
> >> does).
>
> Eric> I disagree: *((int *)p)++ was accepted by virtually all the
> Eric> good old compilers: GCC 2.x, Microsoft, Borland, Watcom. This
> Eric> is a natural idiom when you're manipulating images with
> Eric> different color depths ...
>
> ... or doing alignment-optimized copying. I've seen this notation in
> our code, and I'm pretty sure the author didn't get it from the GCC
> docs. It's a natural thing to write -- unless you ARE a language
> lawyer and understand the hairy details of precisely what is an lvalue
> and what is not.
... and what strict aliasing can do to ruin your code. :-)
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."