diff options
author | Alejandro Colomar <alx.manpages@gmail.com> | 2021-10-20 17:46:20 +0200 |
---|---|---|
committer | Alejandro Colomar <alx.manpages@gmail.com> | 2022-09-05 03:48:11 +0200 |
commit | bd99e6b7c19384728cf41478e7142f9bcada0a2c (patch) | |
tree | 0cfb3a89f19a437b86a12ec966b8775f609301fd | |
parent | 7ca189099d73bde954eed2d7fc21732bcc8ddc6b (diff) |
ctime.3: SYNOPSIS: Use VLA notation for [as]ctime_r() buffer
As N2417 (a proposal for C2x that was not accepted) suggests.
This syntax is very informative, and also, if used by library
implementers, can improve static analysis.
Since it is backwards compatible with pointer syntax, we can do
this. Also, the reason for not being accepted, as Jens noted,
was incompatibility with C++. But IMO, that's not something that
we should care too much. Users of other languages should know
what to expect when reading C code, and are expected to know C/C++
incompatibilities.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Cc: Jens Gustedt <jens.gustedt@loria.fr>
Cc: Glibc <libc-alpha@sourceware.org>
-rw-r--r-- | man3/ctime.3 | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/man3/ctime.3 b/man3/ctime.3 index 8b48c928b..1424c6baa 100644 --- a/man3/ctime.3 +++ b/man3/ctime.3 @@ -24,10 +24,12 @@ Standard C library .B #include <time.h> .PP .BI "char *asctime(const struct tm *" tm ); -.BI "char *asctime_r(const struct tm *restrict " tm ", char *restrict " buf ); +.BI "char *asctime_r(const struct tm *restrict " tm , +.BI " char " buf "[restrict 26]);" .PP .BI "char *ctime(const time_t *" timep ); -.BI "char *ctime_r(const time_t *restrict " timep ", char *restrict " buf ); +.BI "char *ctime_r(const time_t *restrict " timep , +.BI " char " buf "[restrict 26]);" .PP .BI "struct tm *gmtime(const time_t *" timep ); .BI "struct tm *gmtime_r(const time_t *restrict " timep , |