On Sun, 14 Nov 2021 at 22:54, JeanHeyd Meneide <phdofthehouse@gmail.com> wrote:
On Sun, Nov 14, 2021 at 4:06 PM Alejandro Colomar (man-pages)
<alx.manpages@gmail.com> wrote:
> ...
> No, it's not.  There was a proposal (by Jens Gustedt),
> but it wasn't accepted (and I'm happy it wasn't).

     That's strange, because it's still implied as part of our charter
as something that can be done (#15,
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2611.htm), still used
in quite a few functions as part of the upcoming C23 draft (latest
draft N2731 (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2731.pdf),
declarations from §7.12.16.1), and as far as I know I've been
encouraged to do exactly that. Maybe we're not annotating everything,
but we are moving in that direction as a whole, as I understand it.

     w.r.t. C headers working in C++: that's an implementation's
business whether they want to have their C headers work seamlessly in
C++. One way is to have C++ accept C's syntax here, or at the very
least consume such syntax and ignore it. The other way is to employ
all sorts of lovely macros, which is what I (and others) have been
doing for some time. (Not that you even need to take a trip over to
C++! MSVC's C mode still chokes on static pointer extents for
arguments: https://godbolt.org/z/KTYxf7Wq1).

     I would prefer C++ just accept C's syntax since I legitimately
cannot imagine a world where C++ has any use whatsoever for an
argument of void f(T meow[static n]); meaning anything other than what
C does, because I don't think C++ would ever use the word "static"
there to begin with.

> ...
> As I said, '[[nonnull]]' should be added to C & C++ (with the meaning of
> '[[gnu::nonnull]]'), and it would make 'static' obsolete.  If C++ ever
> adds 'static' with that meaning, it would be marked as deprecated from
> day 0, so I think we better keep it out, and let compilers ignore it as
> needed.

     That would be nice too. And probably easy to get in. Maybe I
should write Yet Another Paper™ and ask the C Committee for it. It
doesn't seem like we ever proposed one. C++ probably never asked for
one because they have references, but it'd likely be useful in C since
90% of the stdlib works on non-null pointers, to the point that
implementations use it as an optimization point (much to people's
deep, unending grief).

Sincerely,
JeanHeyd


In other words:

What Could Possibly Go Wrong™

Kind regards ...