News for hackers. Stuff that matters.
Re:C23 is finished: Here is what is on the menu by formerly_proven on Friday August 05, 2022 @05:49AM (#32353813)
> But now, when any type might be larger than an uintmax_t? What do you do?

Complain to POSIX so they add printf macro defines for all their implementation-sized integer types by the year 2100.

Re:C23 is finished: Here is what is on the menu by teddyh on Friday August 05, 2022 @05:59AM (#32353897)
For printf(), that would work. For sscanf(), POSIX could add macros there, too, but sscanf() does not detect integer overflow. That’s why the only previous solution was strtoimax() which does detect overflow.
Re:C23 is finished: Here is what is on the menu by rwmj on Friday August 05, 2022 @06:12AM (#32354003)
scanf not detecting integer overflow is arguably another problem. It's usually the easiest way to parse numbers out of simple strings, but the lack of overflow detection is a problem. (Actually we use sscanf for this and ignore the overflow problem, as long as it doesn't cause any security or correctness concern.) IIRC glibc actually does overflow detection, so there's not anything inherently problematic with adding it.