Hacker News

Favorites Setup
Comment by wahern | original | C for Rust programmers
[−]wahern · 2026-10-11 Sun 09:13 UTC · link
Not sure I agree with this pattern for strings, but if you're gonna multiply for an allocation like that and are concerned about consistent idioms, use calloc or [non-standard] mallocarray, which will check the multiplication for overflow.