73 karma · joined August 2, 2015
( Sorry, I couldn't resist. I found it funny in a sad/ironic way. )
In other words, the title is clickbait.
If the user agreement really allows this, then it is time to stop supporting them.
I saw a couple of his introductory videos and I think he is great to teach specifics about game programming, but should definitely not teach how to write C.
It would be much better to write proper checks or just call functions that do so.
According to this https://news.ycombinator.com/item?id=8181773 then don't even store emails anymore.
Using exceptions?
IMHO only very small fraction of overflow bugs would have been fixed by just wrapping result around.
Yes, switching to wrapping integers is not the solution to overflow. Rather check the operation beforehand. I still think using unsigned integers is always preferred if you don't need negative values.
g << h Well defined because 2147483648 can be represented in a 32 bit unsigned int
Even under those assumptions, it is implementation defined if unsigned int can hold the value 2^31. It is perfectly valid to have an UINT_MAX value of 2^31-1. In that case the code will cause undefined behavior.
The only guarantee for unsigned int is that it's UINT_MAX value is at least 2^16-1, regardless of its bit size, and that it has at least as much value bits as a signed int.
For example C allows these ranges:
int: -2^31 , 2^31-1
unsigned int: 0 , 2^31-1