2 ms·
Thank you for detailed explanation. > Modern languages like Java or Swift just give this well defined semantics and call it a day because this isn’t a good hil
by rdtsc 3y ago
Thank you for detailed explanation.
> Modern languages like Java or Swift just give this well defined semantics and call it a day because this isn’t a good hill to die on. Fucking up the language isn’t worth 0.3% on some stupid benchmark, period.
I saw some projects just opt to use -fwrapv as a gcc option. clang I think has the same one too now. The docs for gcc mentions [1] "This flag enables some optimizations and disables others"
[1] https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html
- pizlonator 3y agoYeah. It would be great if either of these things happened: - signed overflow was defined to wrap like -fwrapv does. - overflow of any kind is guaranteed to trap. The latter would be better for sanity and security but I’ll take what I can get.