News for hackers. Stuff that matters.
Re:size_t-to-int vulnerability in Linux’s filesystem layer by chippiewill on Tuesday July 20, 2021 @02:26PM (#27897351)
> are there any low-level/systems languages where a demoting cast with a generated runtime check gets the simple/clean syntax-sugared semantics (to encourage/favor its use), while truncating demotion requires a clumsier syntax (to discourage its use)?

Not exactly the same thing, but in a related area C++ does this a bit.

In C++ you can always still do a c-style cast `(int) some_var` (and the implicit casts obviously), but in general you're meant to use the C++ style explicit casts like `static_cast` and `const_cast`. These are generally tidy, but the most powerful and dangerous of these casts is deliberately awkwardly named as `reinterpret_cast<int>(some_var)` rather than something terse.

It's always easy to spot during a code review.

Re:size_t-to-int vulnerability in Linux’s filesystem layer by gumby on Tuesday July 20, 2021 @05:01PM (#27899280)
You can have your compiler warm about c-style casts