Subject: Re: [boost] safe integer library -- the scope
From: Robert Ramey (ramey_at_[hidden])
Date: 2015-12-11 21:10:01
On 12/11/15 5:50 PM, Robert Ramey wrote:
To belabor the point, consider this little program:
using namespace std;
int8_t x = 100;
int y = x * x;
cout << y << endl;
uint32_t z1 = 100;
int8_t z2 = -100;
auto y2 = z1 * z2;
cout << y2 << endl;
which prints out:
This is due to the application of the C++ type promotion rules.
Is it any reason that C++ drives people crazy?
One looks at the program and sees arithmetic. One executes the program
an gets ... well I don't know what you're getting.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk