Re: another -Wunsequenced topic

From: <dt71_at_gmx.com>
Date: Mon, 08 Jul 2013 13:43:58 +0200
Well, this turned out to be a semi-false alarm. A week ago, for a short time, there was a bug in Clang. There is no undefined behavior in

   ptr = func(++ptr);,

partially because a function call introduces a sequence point in C, but Clang did not respect this at that time. However,

   x = func1(++ptr) + func2(++ptr);

is compiler-dependent. Additionally, if func() turns out to be a macro, rather than a native function, then undefined behavior (due to unsequencedness) occurs. According to the manpage for ntohl(): "On machines which have a byte order which is the same as the network order, routines are defined as null macros.". This can bite libstand on big-endian systems

So in the end, Clang has accidentally pointed me to an irrelated bug, and induced some unnecessary code changes. lolz
Received on Mon Jul 08 2013 - 09:44:39 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:39 UTC