This commit is contained in:
Gabriel Dos Reis
2017-09-11 10:36:50 -07:00
parent 9840eefacf
commit 7146b55d30

View File

@@ -12661,10 +12661,10 @@ Using `unsigned` doesn't actually eliminate the possibility of negative values.
##### Example ##### Example
unsigned int u1 = -2; // OK: the value of u1 is 4294967294 unsigned int u1 = -2; // Valid: the value of u1 is 4294967294
int i1 = -2; int i1 = -2;
unsigned int u2 = i1; // OK: the value of u2 is 4294967294 unsigned int u2 = i1; // Valid: the value of u2 is 4294967294
int i2 = u2; // OK: the value of i2 is -2 int i2 = u2; // Valid: the value of i2 is -2
These problems with such (perfectly legal) constructs are hard to spot in real code and are the source of many real-world errors. These problems with such (perfectly legal) constructs are hard to spot in real code and are the source of many real-world errors.
Consider: Consider: