Skip to contentSkip to conversation

strfromd.3: restrict? C99?

DISCUSSION Alejandro Colomar (man-pages) 2 participants 2 messages Mar 10, 2021 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

Hello Michael, Wainer,

It's weird. The only manual page that I've seen using restrict, and I think it's wrong. glibc doesn't use it:

.../glibc$ grep_glibc_prototype strfromd src/gnu/glibc/stdlib/stdlib.h:212:
extern int strfromd (char *__dest, size_t __size, const char *__format,

		     double __f)
     __THROW __nonnull ((3));
.../glibc$ grep_glibc_prototype strfromf
src/gnu/glibc/stdlib/stdlib.h:216:
extern int strfromf (char *__dest, size_t __size, const char *__format,
		     float __f)
     __THROW __nonnull ((3));
.../glibc$ grep_glibc_prototype strfroml
src/gnu/glibc/stdlib/stdlib.h:220:
extern int strfroml (char *__dest, size_t __size, const char *__format,
		     long double __f)
     __THROW __nonnull ((3));

.../glibc$

And the manual page states that it conforms to some standards, but I haven't found it in C99 (neither in C11 nor C18) nor in POSIX:

$ man 3 strfromd | sed -n '/CONFORMING/,/^$/p'
CONFORMING TO
       C99, ISO/IEC TS 18661-1.
$ man 3p strfromd
No manual entry for strfromd in section 3p
$

I don't know what that other "ISO/IEC TS 18661-1" is.

<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf>
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>
<https://web.archive.org/web/20181230041359if_/http://www.open-std.org/jtc1/sc22/wg14/www/abq/c17_updated_proposed_fdis.pdf>

Should I remove restrict? And C99 from the CONFORMING TO section?

Thanks,

Alex

Signature · 3 lines
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
#1 lore raw
Quoted 2 lines · Alejandro Colomar (man-pages) via Libc-alpha

And the manual page states that it conforms to some standards, but I haven't found it in C99 (neither in C11 nor C18) nor in POSIX:

The strfrom functions are in TS 18661-1, and draft C23 which integrated all of TS 18661-1 and -2 and parts of -4 (-3 will be added in an Annex). They use restrict in both places. So it would be appropriate to use __restrict in the glibc header (as documentation, qualifiers on function parameter types in a declaration that isn't a definition don't have any semantic effect).

Signature · 2 lines
Joseph S. Myers
[email protected]