Hi Martin, On Sun, May 05, 2024 at 04:47:21PM +0200, Martin Uecker wrote: > Am Sonntag, dem 05.05.2024 um 15:13 +0200 schrieb Alejandro Colomar: > > Hi Martin, > > > > I was wondering why C23 didn't use QChar for strtol(3). It has the same > > problems that string functions have: a const input string and a > > non-const output string (the endptr). > > I am not sure whether strtol was discussed. > > > > > I think endptr should have the same constness of the string passed to > > strtol(3), no? > > > > Should this be addressed for C3x? For liba2i.git, I'm working on > > const-generic versions of strtol(3) wrappers, which have helped simplify > > the const/non-const mix of pointers in shadow.git. > > One potential issue is that for strtol such a change would break > all callers that pass a const-qualified pointer as first argument > and provide an argument for enptr second, which now has to be > a pointer to a non-const pointer.
Yep, it is more aggressive with existing code than e.g. strchr(3). > > For the functions we changed this breaks only cases where > a const qualified pointer is passed and then the result > is assigned to a non-const pointer, which could already be > considered questionable in existing code. Hmmm, okay. I'll then just provide my library to replace strtol(3) calls, and hope that programmers switch to it voluntarily. Thanks! Have a lovely day! Alex -- <https://www.alejandro-colomar.es/> A client is hiring kernel driver, mm, and/or crypto developers; contact me if interested.
signature.asc
Description: PGP signature