bug-standards
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: standards.texi update for newer POSIX and C standards


From: Paul Eggert
Subject: Re: standards.texi update for newer POSIX and C standards
Date: Wed, 1 May 2024 21:15:28 -0700
User-agent: Mozilla Thunderbird

On 2024-05-01 20:14, Richard Stallman wrote:
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

   > The main change is to say that it's OK to assume C99, except for VLAs.

Could you state that in a more unambiguous way?

Sure, here's a rephrasing of that text. (This rephrased text isn't intended to be in standards.texi; it's merely my commentary on the proposed update to standards.texi.)

----
The main change is to say that it's OK to assume C99. Many (most?) GNU programs are doing this already, e.g., by using declarations after statements which is a feature added in C99. We no longer have to worry about porting to strict C89 systems that reject these C99 features, as C89-only systems are no longer of practical interest.

There is one exception, though: variable length arrays (VLAs). Although a useful feature added in C99, VLAs have significant technical problems (e.g., they make it easier to launch attacks on buggy programs), and VLAs are optional in C11 and later. Because of the technical issues some environments discourage the use of VLAs (e.g., via something like 'gcc -Werror=vla') or even do not support them, so it can be helpful to use VLAs only if supported, just as you might use any other optional feature. In C11 or later, programs can test whether the predefined C macro __STDC_NO_VLA__ is defined to decide whether to use VLAs; if you want your code also to be portable to C99 systems you can either use the Gnulib 'vla' module, or check both __STDC_NO_VLA__ and __STDC_VERSION__.

This patch also drops most coverage of the K&R function definition syntax, as C23 no longer requires support for that syntax so it is no longer portable. For example, K&R style does not work if you compile with 'gcc -std=gnu23'.

Also, C23 removed trigraphs (finally!).

There is no longer a "POSIX.2"; it's just POSIX.1.

Long options like --help are not prohibited by POSIX, as far as I can see. Perhaps old POSIX prohibited them, but that ship sailed long ago, they're now universal, and I don't see POSIX prohibiting them now.
----


Does "VLA" mean "variable length arrat"?

Yes.


Whatever feature it means, what specificallky is the way you suggest
handling it, and why?

I tried to address that in the above reworded text.


   > This patch also drops coverage of the K&R function definition style,

Could you explain what it means to "drop coverage"?  Are you proposing
a documentation change, or a change in GCC, or what?

I'm proposing a change to standards.texi. standards.texi currently contains many examples of the K&R style, but these examples no longer work in C23 and standards.texi should therefore remove them. There is no significant technical advantage to K&R style, and since it's now officially unportable standards.texi shouldn't recommend it in portable code.

                                                                       as
   > this is no longer needed on practical platforms

Could you plesae state more clearly just what is no longer needed...?

The above text tries to do that.


Let's not adopt the term "pre-standard".

OK, but the term "pre-standard" is already in standards.texi. It's easy to remove all uses of that term, though, and I did that in the revised proposed patch, which is attached.

Attachment: standards.texi.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]