Sujet : Re: Suggested method for returning a string from a C program?
De : david.brown (at) *nospam* hesbynett.no (David Brown)
Groupes : comp.lang.cDate : 24. Mar 2025, 13:09:00
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vrri0s$qila$2@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0
On 23/03/2025 20:35, Tim Rentsch wrote:
Richard Heathfield <rjh@cpax.org.uk> writes:
On 22/03/2025 23:46, Tim Rentsch wrote:
>
Here is my summary of the corresponding list in the C11 standard
(descriptive headings reprepresent my own views on each area):
>
Thank you, Tim. What I'm taking away from this is that I'm not
personally affected by the changes.
I had a similar reaction when C99 came out. In fact it was several
years before I started looking at C99 as a suitable alternative to
using just C90. Gradually I began to see that the new features of
C99 offered substantial advantages over what C90 offers. My
impression is the C community at large followed a similar timeline.
For C11 I am somewhere in the middle. Most of the time I find C99
adequate, and don't need the capabilities added in C11; so C99 is
still my default choice, with C11 being the exception. However,
for building software libraries rather than just programs, C11
allows some significant benefits, so I am turning more and more
to C11 as I add functionality to the library projects I'm working
on. (I should add that I try to write code that can benefit from
C11 but still can be called from C99 or C90, perhaps with reduced
functionality.)
I can somewhat agree with those sentiments.
In my field, C99 support was not an option for many compilers for several years - some toolchains have never had good support for it. (I remember seeing a toolchain in the 2010's advertised as "now with partial C99 support" as a feature.) So it took time before I could use it properly.
However, once I got used to it, the difference to the way I code was significant. I greatly dislike the occasions when I have to go back to the middle ages coding in C90 - though not as much as the dark ages of large-scale assembly programming. I have not the slightest doubt that with C99, my code is clearer, better structured, has a lower risk of errors and is easier to maintain than with C90. I won't claim it is /hugely/ better, but it is definitely significant. C99 is when C grew up.
The changes in C11 are much less, but there are some that are useful to me. C17 is just a bug-fix (and slightly nicer typography). C23 has a number of useful features, but again is not like the step from C90 to C99. (And of course newer standards always have features that I dislike too.)
One thing I generally like with newer standards is that it can mean fewer implementation-specific features in my code, or fewer ugly workarounds. I expect to see at least some of my gcc __attribute__'s replaced by [[C23 attributes]]. C11 came with a real _Static_assert, instead of having to use ugly macros for the task. These sorts of things don't make a big impact in my code (and are often tidied away in macros anyway), but are nice to see.
I don't expect to be relying on C23 features for a while yet, however - I expect most of my new C code to be compatible with C99 (or at least, "gnu99"). And of course I won't change existing projects to newer standards.