Re:Checked integer arithmetic in the prospect of C23
by tinglymintyfrsh on Monday December 19, 2022 @01:27PM
(#34055648)
Also, Hacker's Delight and OpenBSD probably have clever solutions for these.
[ Parent
| on HN ]
Re:Checked integer arithmetic in the prospect of C23
by wahern on Monday December 19, 2022 @10:15PM
(#34061108)
Surprisingly, OpenBSD does not have a library (neither a public API nor even just routines which are copied project-to-project as is common with OpenBSD utilities and daemons) to handle arithmetic overflow. The closest might be malloc/realloc extensions, like reallocarray, that handle common scenarios where arithmetic overflow is seen.