3 ms·
It's not a tricky corner of C. It's the most basic C thing ever if you are not not negligent and actually check the standard for what happens when you overflow
by bluecalm 11y ago
It's not a tricky corner of C. It's the most basic C thing ever if you are not not negligent and actually check the standard for what happens when you overflow a signed int.
I mean, the C standard isn't that long nor complicated.
There aren't many basic types in C, learning how they behave in basic situations like division by 0, overflow etc. is an hour long task.
- eloff 11y agoMay I refer you to the 13 pages of section J.2 Undefined behavior of the C standard[1]. I hope you don't have any other appointments after your "hour long" task... [1]http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
- bluecalm 11y agoWe are talking about the basic operations on basic types in C, not all possible undefined behaviors. You don't need to learn a list of possible undefined behaviors. You just need to check how your basic types behave when you try to store numbers too big for the number of bits they have. It's something you learn in like first few hours of your introductory C course.
- pjmlp 11y agoAssuming you aren't targeting multiple systems, which with its own C compiler.