Thread (36 messages) 36 messages, 9 authors, 2024-07-06

Re: [PATCH v1] Remove 'restrict' from 'nptr' in strtol(3)-like functions

From: Jonathan Wakely <hidden>
Date: 2024-07-05 19:38:28

On Fri, 5 Jul 2024 at 20:28, Alejandro Colomar [off-list ref] wrote:
Hi,

On Fri, Jul 05, 2024 at 06:30:50PM GMT, Martin Uecker wrote:
quoted
Am Freitag, dem 05.07.2024 um 17:24 +0100 schrieb Jonathan Wakely:
quoted
On Fri, 5 Jul 2024 at 17:02, Xi Ruoyao via Gcc [off-list ref] wrote:
quoted
On Fri, 2024-07-05 at 17:53 +0200, Alejandro Colomar wrote:
quoted
At least, I hope there's consensus that while current GCC doesn't warn
about this, ideally it should, which means it should warn for valid uses
of strtol(3), which means strtol(3) should be fixed, in all of ISO,
POSIX, and glibc.
It **shouldn't**.  strtol will only violate restrict if it's wrongly
implemented, or something dumb is done like "strtol((const char*) &p,
&p, 0)".

See my previous reply.
That's not right.  See my reply to yours, Xi.  The restrict in

        char **endptr

already prevents calls such as strtol(x, x, 0).
That seems to contradict footnote 153 in C23.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help