Linux Manual Pages development
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx+linux-man@kernel.org>
To: Martin Uecker <uecker@tugraz.at>
Cc: linux-man@vger.kernel.org,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	 Christopher Bazley <chris.bazley.wg14@gmail.com>,
	Sam James <sam@gentoo.org>, Carlos O'Donell <carlos@redhat.com>,
	 "Joseph S. Myers" <josmyers@redhat.com>
Subject: Re: [PATCH] man/: SYNOPSIS: Remove GNU forward-declarations of parameters for lengths of array parameters
Date: Thu, 22 Oct 2026 22:27:00 +0200	[thread overview]
Message-ID: <atpuEfs7NFU5gQvb@debian> (raw)
In-Reply-To: <atpp6tUO5GfMFkcB@debian>

[-- Attachment #1: Type: text/plain, Size: 3736 bytes --]

Hi Martin,

> Date: 2026-10-22 22:01:17+0200
> From: Alejandro Colomar <alx+linux-man@kernel.org>
>
[...]
> >  I still do not like it, as the fully developed form
> > would be a major pain for most C compiler to implement, but
> > I guess a restricted version would be ok.  Unfortunately, this
> > syntax does not work today, so could be used in code only at
> > some point in the future. 

This syntax is useless for us.  We have several functions that need to
write expressions in array lengths, and not just identifiers.  We even
dereference some pointer types (see getsockopt(2), lfind(3), and
lsearch(3)).

It's also useless for me as a programmer, since I need to do non-trivial
stuff in my array sizes.  Whatever we add to the language should work
for arbitrary types and expressions.

Here's a list of functions we have documented and which need a
non-restricted feature.

     long get_mempolicy(unsigned long maxnode;
                        int *mode,
                        unsigned long nodemask[(maxnode + ULONG_WIDTH - 1)
                                               / ULONG_WIDTH],
                        unsigned long maxnode, void *addr,
                        unsigned long flags);

     char *inet_net_ntop(int bits, size_t psize;
                       int af,
                       const void netp[(bits - CHAR_BIT + 1) / CHAR_BIT],
                       int bits,
                       char pres[psize], size_t psize);

     int getsockopt(socklen_t *restrict optlen;
                    int sockfd, int level, int optname,
                    void optval[_Nullable restrict *optlen],
                    socklen_t *restrict optlen);

     void *bsearch(size_t n, size_t size;
                   const void key[size], const void base[size * n],
                   size_t n, size_t size,
                   typeof(int (const void [size], const void [size]))
                       *compar);

     /* In SCO OpenServer */
     void cfree(unsigned int n, unsigned int size;
                char ptr[size * n], unsigned int n, unsigned int size);

     /* In Solaris watchmalloc.so.1 */
     void cfree(size_t n, size_t size;
                void ptr[size * n], size_t n, size_t size);

     size_t fread(size_t size, size_t n;
                  void ptr[restrict size * n],
                  size_t size, size_t n,
                  FILE *restrict stream);
     size_t fwrite(size_t size, size_t n;
                  const void ptr[restrict size * n],
                  size_t size, size_t n,
                  FILE *restrict stream);

     size_t fread_unlocked(size_t size, size_t n;
                           void ptr[restrict size * n],
                           size_t size, size_t n,
                           FILE *restrict stream);
     size_t fwrite_unlocked(size_t size, size_t n;
                           const void ptr[restrict size * n],
                           size_t size, size_t n,
                           FILE *restrict stream);

     void *lfind(size_t *n, size_t size;
                 const void key[size],
                 const void base[*n * size],
                 size_t *n, size_t size,
                 typeof(int (const void [size], const void [size]))
                     *compar);
     void *lsearch(size_t *n, size_t size;
                 const void key[size],
                 void base[*n * size],
                 size_t *n, size_t size,
                 typeof(int (const void [size], const void [size]))
                     *compar);

I might have missed some other functions; I think this isn't exhaustive.


Cheers,
Alex

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-10-22 20:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 16:44 [PATCH] man/: SYNOPSIS: Remove GNU forward-declarations of parameters for lengths of array parameters Alejandro Colomar
2026-10-22 17:11 ` Martin Uecker
2026-10-22 20:01   ` Alejandro Colomar
2026-10-22 20:27     ` Alejandro Colomar [this message]
2026-10-22 17:37 ` Christopher Bazley
     [not found] ` <CAEHU8x9jET+vcrR0NpDz6t57egQG8TZqx5XtV52srH9ZRvdxSQ@mail.gmail.com>
2026-10-22 19:54   ` Alejandro Colomar
2026-10-23 11:53     ` Michael Kerrisk (man7.org)
2026-10-23 12:42       ` Alejandro Colomar
2026-10-23 15:51       ` Christopher Bazley
2026-10-24 12:45         ` Michael Kerrisk (man7.org)
2026-10-24 13:38           ` Alejandro Colomar
2026-10-24 16:16             ` Christopher Bazley
2026-10-24 16:37               ` Alejandro Colomar
2026-10-24 18:11                 ` Martin Uecker
2026-10-25  6:59                   ` Alejandro Colomar
2026-10-25  7:22                     ` Martin Uecker
2026-10-25  7:38                       ` Alejandro Colomar
2026-10-25  8:29                         ` G. Branden Robinson
2026-10-25  8:40                         ` Martin Uecker
2026-10-25  8:57                           ` Alejandro Colomar
2026-10-25  9:05                             ` Martin Uecker
2026-10-23 12:11     ` Alejandro Colomar
2026-10-22 22:03 ` Mark Harris
2026-10-23  9:43   ` Alejandro Colomar
2026-10-23 19:32     ` Mark Harris
2026-10-23 20:06       ` Alejandro Colomar
2026-10-24  7:53   ` Martin Uecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=atpuEfs7NFU5gQvb@debian \
    --to=alx+linux-man@kernel.org \
    --cc=carlos@redhat.com \
    --cc=chris.bazley.wg14@gmail.com \
    --cc=josmyers@redhat.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=sam@gentoo.org \
    --cc=uecker@tugraz.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox