|
|
Message-ID: <9e273e5d-9738-4240-8b9d-b3258b0d333d@gmail.com> Date: Sat, 6 Dec 2025 11:35:12 +0700 From: lev <levrymvc@...il.com> To: Rich Felker <dalias@...c.org> Cc: musl@...ts.openwall.com, mamutrahal269 <idodo4nm@...ton.me> Subject: Re: [PATCH] POSIX positional arg numbering (1-based) and multi-digit support in printf_core, raise NL_ARGMAX to 255 On 12/6/25 01:54, Rich Felker wrote: > On Fri, Dec 05, 2025 at 11:39:45AM +0700, mamutrahal269 wrote: >> The positional argument parsing logic in printf_core was reworked: instead of only accepting single-digit >> positional indices, the code now uses getint() to read multi-digit numbers and checks for the terminating $. >> The old logic isdigit(s[1]) && s[2]=='$' was replaced with proper multi-digit parsing to support numbers >> larger than 9. Additional validation was added to reject zero as an argument index and to detect overflow >> when the index exceeds NL_ARGMAX. Similar multi-digit parsing was implemented for width and precision >> arguments using * with positional indices. Finally, NL_ARGMAX was increased from 9 to 255 in limits.h >> to match the expanded positional argument range. > What is the motivation for this change? The current choice we have is > intentional so long as the standard specifies only that it be at least > 9 -- programs that depend on having more are not portable, and using a > large value like 255 increases the stack pressure of the printf-family > functions quite a bit (I believe something like 3x the current amount > on archs with 16-byte long double). > > Rich Yes, you're right about portability. The stack issue can be solved, but it still doesn't make sense to encourage programs that are inherently unportable. Thanks for the explanation.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.