Re: [PATCH 1/5] add SWAP macro

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

 



Am 30.01.2017 um 22:03 schrieb Johannes Schindelin:
It is curious, though, that an
expression like "sizeof(a++)" would not be rejected.

Clang normally warns about something like this ("warning: expression with side effects has no effect in an unevaluated context [-Wunevaluated-expression]"), but not if the code is part of a macro. I don't know if that's intended, but it sure is helpful in the case of SWAP.

Further, what would SWAP(a++, b) do? Swap a and b, and *then* increment a?

That might be a valid expectation, but GCC says "error: lvalue required as unary '&' operand" and clang puts it "error: cannot take the address of an rvalue of type".

René



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]