|
|
|
|
|
by dzaima
115 days ago
|
|
> it's still a counterexample for "you can't define it because it means sanitizers can't warn for it" Sure, technically you can write a sanitizer for anything. It just becomes less a "sanitizer" you can always recommend everyone everywhere use, and more of just a heuristic thing that only really works if you design your code for its arbitrary desires. > and in the cases where it actually is intentional you can suppress the check. imo it'd be nice to have separate types for wrapping and non-wrapping integers for that, so that you have actual language-level semantics and an easy way to mix things (e.g. wrapping arith for hashing, mixed with non-wrapping arith for loop index or whatever) instead of suppressions. |
|
Sure, and that's basically what I was wondering about with respect to "can't define it" being shorthand for something else
> imo it'd be nice to have separate types for wrapping and non-wrapping integers for that
I think I'd agree, though I'd imagine it's a bit late for such things to be deeply integrated into the language. At least making your own isn't horrendously difficult.