Compilation error

Greg Haerr greg at censoft.com
Sun Sep 9 08:39:28 PDT 2007


:   ((type)x)++
: 
: which is not allowed in Standard C.  The cast produces a value, not a
: modifiable object.  The ++ operator requires a modifiable object.  If
: your compiler is allowing it, then it must have an extension to create
: objects from casts.  As mentioned, older versions of gcc had just such
: an extension.

I've always thought the above was a useful construct, if dangerous.
How can the same result be achieved without the extra step of
copying to a temp variable of the desired type?  Will gcc 4.x
optimize this out if the temp variable is auto?

Regards,

Greg



More information about the uClibc mailing list