OT (partially): about promotion of integers

Walter Bright newshound2 at digitalmars.com
Wed Dec 12 13:25:00 PST 2012


On 12/12/2012 4:51 AM, Araq wrote:
>  From http://embed.cs.utah.edu/ioc/
>
> " Examples of undefined integer overflows we have reported:
>
>      An SQLite bug
>      Some problems in SafeInt
>      GNU MPC
>      PHP
>      Firefox
>      GCC
>      PostgreSQL
>      LLVM
>      Python
>
> We also reported bugs to BIND and OpenSSL. Most of the SPEC CPU 2006 benchmarks
> contain undefined overflows."

Thanks, this is interesting information.


> So how does D improve on C's model? If signed integers are required to wrap
> around in D (no undefined behaviour), you also prevent some otherwise possible
> optimizations (there is a reason it's still undefined behaviour in C).

D requires 2's complement arithmetic, it does not support 1's complement as C does.


More information about the Digitalmars-d mailing list