3 ms·
If it's wrong break on compiler time, not on run time The problem is the compiler going implementation defined on the multiplication/assignment then going all
by raverbashing 4y ago
If it's wrong break on compiler time, not on run time
The problem is the compiler going implementation defined on the multiplication/assignment then going all language lawyer on the following line and blaming the user
> In general, addition like 'a + b' also isn't safe in C.
Cool, another reason to retire it
- josephcsible 4y ago> If it's wrong break on compiler time, not on run time The number being multiplied isn't known until runtime, so there's not a good way of doing this.
- raverbashing 4y agoWell, funny that the compiler sees no problem in removing a check (on compile time) of a value that is totally possible to obtain, on runtime
- UncleEntity 4y agoIsn’t the very base issue the program didn’t sanitize the input? Just blindly accepting user input is universally bad methinks.
- raverbashing 4y agoWe might ask if gcc will feel like keeping the sanitizing checks or it will take them out due to some bout of language lawyering as well...
- eru 4y agoI'm not sure what you mean by 'keping the sanitizing check'? A C program is basically a bunch of bytes, and the C standard tells you what those bytes are supposed to mean. A compiler's job is to translate the bytes into whatever target language you fancy, and making sure to preserve the proscribed behaviour. And that's exactly what the compiler did.