Thread (3 messages) 3 messages, 3 authors, 2022-04-01

Re: [PATCH] CodingGuidelines: give deadline for "for (int i = 0; ..."

From: brian m. carlson <hidden>
Date: 2022-03-31 21:19:27

On 2022-03-31 at 20:12:09, Junio C Hamano wrote:
Ævar Arnfjörð Bjarmason [off-list ref] writes:
quoted
quoted
A separate weather balloon for C99 as a whole was raised separately
in 7bc341e2 (git-compat-util: add a test balloon for C99 support,
2021-12-01).  Hopefully, as we find out that all C99 features are OK
on all platforms we care about, we can stop probing the features we
want one-by-one like this
Unfortunately this really isn't the case at all, the norm is for
compilers to advertise that they support verison X of the standard via
these macros when they consider the support "good enough", but while
there's still a long list of unimplemented features before they're at
100% support (and most never fully get to 100%).

We also need to worry about the stdlib implementation, and not just the
compiler, see e.g. the %zu format and MinGW in the exchange at
https://lore.kernel.org/git/220318.86bky3cr8j.gmgdl@evledraar.gmail.com/ (local)
and
https://lore.kernel.org/git/a67e0fd8-4a14-16c9-9b57-3430440ef93c@gmail.com/ (local);

But I think we're thoroughly past needing to worry about basic language
features in C99 such as these inline variable declarations.
Well, that makes it sound like the C99 weather balloon was almost
useless, doesn't it?
I think if we were talking about C17, maybe.  But as I said in my commit
message, C99 is over two decades old and required for the POSIX version
which came out in 2001.  I'm aware of only two platforms we care about
that don't support that POSIX version, which are NonStop and Windows.

I think the likelihood of this being a problem is very low.  And I think
we can justifiably expect that major syntactic functionality is
available when the define is set accordingly.  I am also willing to
simply tell people that a compiler that includes the define and doesn't
include the requisite features is buggy and ask them to use a modern
version of GCC or clang.  But, ultimately, given we're talking about
C99, this is extremely unlikely to ever be a problem in 2022.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help