3 ms·
Some compiler decided to define overflow as wrapping. Such as GCC/clang when passing the -fwrapv flag. Most projects don't use that flag though, why not? Nite
by jenadine 2y ago
Some compiler decided to define overflow as wrapping. Such as GCC/clang when passing the -fwrapv flag.
Most projects don't use that flag though, why not?
Nite that if you assume -fwrapv, you're not writing in C anymore, you're using a vendor specific dialect.
- immibis 2y agoEveryone writes in vendor-specific dialects of C. Both POSIX and Win32 define behaviour that isn't defined in C (such as rules for unaligned pointers), while also undefining behaviour that is defined in C (such as what happens if you call fopen when one of the functions in your program is called "open"). Even on embedded platforms, there's no "main" function in freestanding C - your entry point is a vendor-specific extension.