Deutsch English Français Italiano |
<vrri0s$qila$2@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: David Brown <david.brown@hesbynett.no> Newsgroups: comp.lang.c Subject: Re: Suggested method for returning a string from a C program? Date: Mon, 24 Mar 2025 13:09:00 +0100 Organization: A noiseless patient Spider Lines: 63 Message-ID: <vrri0s$qila$2@dont-email.me> References: <vrd77d$3nvtf$2@dont-email.me> <87a59hvgyk.fsf@nosuchdomain.example.com> <vrdi0g$47cb$3@dont-email.me> <vrdifm$4n2o$1@dont-email.me> <vrdj4b$47cb$4@dont-email.me> <vrdkcb$4n2o$2@dont-email.me> <86ecyronqa.fsf@linuxsc.com> <vrh548$3a4q5$1@dont-email.me> <86a59fo910.fsf@linuxsc.com> <865xk0ljcb.fsf@linuxsc.com> <vrogin$1ut0v$2@dont-email.me> <861punleus.fsf@linuxsc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 24 Mar 2025 13:09:00 +0100 (CET) Injection-Info: dont-email.me; posting-host="aff7e84aa47b82b9c39de36ffb8a5c58"; logging-data="871082"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19cQESltKPmCPXdQyv6JhIsur/ROeOCOo4=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Cancel-Lock: sha1:Q8BuW18EjuH3uvpTvtyxq6HTPTA= In-Reply-To: <861punleus.fsf@linuxsc.com> Content-Language: en-GB Bytes: 4667 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.