apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mattias EngdegÄrd <matti...@bredband.net>
Subject Re: Event and atomics, round II
Date Thu, 09 Jan 2014 13:49:18 GMT
9 jan 2014 kl. 14.37 skrev Jim Jagielski:

> However, if a is 4,294,967,200, then the behavior
> of (int)a is undefined and implementation dependent,
> since you can't express that value within the
> limits of a signed int (assuming 32 bits).

No, it's not undefined but implementation-defined, which means that an  
implementation can decide what to do as long as it documents it. There  
is quite a difference.

All compilers I have ever used, and then some, treat conversions to  
signed by modular reduction into the interval defined by that type.  
Nothing else makes sense, and compilers won't start doing it  
differently.

> My point is that the possibility in that case of
> (int)a resulting in 0 is pretty freakin' remote,
> even if it is undefined behavior ;)

It's not undefined behaviour.


Mime
View raw message