[parisc-linux] gcc and ++
Matthew Wilcox
willy@debian.org
Wed, 2 Oct 2002 13:24:11 +0100
On Wed, Oct 02, 2002 at 09:30:03AM +0200, phi wrote:
> #define get_4(p) ( ((uint32)(*p++)<<24)| \
> ((uint32)(*p++)<<16)| \
> ((uint32)(*p++)<<8 )| \
> ((uint32)(*p++)) )
Undefined behaviour. `|' is not a sequence point and you modify p more than
once. How would this look?
#define get_4(p) p += 4, (((uint32)p[-4] << 24) | \
((uint32)p[-3] << 16) | \
((uint32)p[-2] << 8) | \
((unit32)p[-1]))
comma _is_ a sequence point, so this is well-defined.
--
Revolutions do not require corporate support.