Hi Xi, On 12/3/22 16:55, Xi Ruoyao wrote: > On Sat, 2022-12-03 at 16:33 +0100, Alejandro Colomar via Libc-alpha > wrote: >> Hi! >> >> I'm documenting NULLness of parameters in the Linux man-pages.  While doing >> that, I noticed bind(2) is not prototyped with nonnull, but I don't think it >> makes sense to accept NULL.  Is it a mistake?  Should I send a patch for adding it? > > Hi Alejandro, > > Currently the man page says: > > EFAULT: addr points outside the user's accessible address space. > > And bind(2) indeed sets errno to EFAULT and return -1 when NULL is > passed as addr. > > gnu::nonnull is not only a diagnostic attribute: it also allows the > compiler to assume addr is never NULL. i. e. if addr was gnu::nonnull > and bind(2) is called with addr == NULL, the behavior would be > undefined. > > So this will be an API change. Yes I agree calling bind with NULL does > not make any sense, but I guess we still need to keep API > "compatibility" with those nonsense code... > Hmmm, makes sense. What I'll do (unless someone opposes and suggests that I do otherwise), though, is ignore that problem in the man-pages. I'm documenting _Nullable instead of _Nonnull, since there are much less places where it needs to be added, so what I'll do is be silent in the case of bind(2). I'm not specifying _Nonnull, so it's not a lie, but I'm not suggesting programmers that they should be careless about NULL, which I wouldn't want to do. Thanks for the prompt answer! Cheers, Alex --