Something odd I noticed today:

#include <CoreServices/CoreServices.h>

int main( int argc, char** argv )
{
    UInt32 a = 0;
    a += (double) -1;
    printf( "%d\n", a );

    return a;
}

this code prints 0 on an Intel Mac, but prints -1 on a PowerPC. So, essentially the PPC seems to just overflow, but the Intel CPU seems to refuse to go below 0.

I guess it's a matter of definition, but does anyone know the official reasoning behind this? I.e. know whether the C standard or Intel/IBM/Motorola specify that this should be so?

Just curious...