|
Message-ID: <30474c83-aa94-05d3-b7d6-aea3a0bd4e63@gmail.com> Date: Sun, 16 Apr 2023 15:20:59 +0200 From: Gabriel Ravier <gabravier@...il.com> To: Jₑₙₛ Gustedt <jens.gustedt@...ia.fr> Cc: musl@...ts.openwall.com Subject: Re: [PATCH v2 1/1] vfprintf: support C2x %b and %B conversion specifiers On 4/16/23 08:51, Jₑₙₛ Gustedt wrote: > Gabriel, > it also seems to me that ... > > on Sat, 15 Apr 2023 14:28:28 +0200 you (Gabriel Ravier > <gabravier@...il.com>) wrote: > >> + /* This buffer is used for integer conversions. As such, it needs >> + * to be able to contain the full representation of a number in base 2, >> + * 8, 10 or 16, with base 2 having the largest possible requirement of >> + * as many characters as the amount of bits in the largest >> possible >> + * integer type */ >> + char buf[sizeof(uintmax_t)*CHAR_BIT]; > ... here a `+3` seems to be in order to take care of the `0[bx]` > prefix and a terminating null byte. This buffer is only used specifically for storing converted digits, and is never used to store the alternative form, and never contains a null terminator either as the code knows the used length and never passes the buffer to a function that doesn't do so, so from what I can see these objections are wrong (in fact it wouldn't make much sense to store the prefix in that buffer given that the code also has to handle the possibility of extremely large 0-padding that goes between the prefix and the converted digits). Though perhaps the comment could be improved, I suppose it could be confusing... > > Thanks > Jₑₙₛ >
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.