Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: bart Newsgroups: comp.lang.c Subject: Re: What is wrong with malloc? (Was: So You Think You Can Const?) Date: Thu, 9 Jan 2025 15:28:25 +0000 Organization: A noiseless patient Spider Lines: 35 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 09 Jan 2025 16:28:25 +0100 (CET) Injection-Info: dont-email.me; posting-host="90fe8b923f7e0b80b300a892eafa8c89"; logging-data="3599577"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18wcyxCUe/gY74+rtnkntsY" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:5pURzLvwtVo94G9xhSiBqK16iNE= Content-Language: en-GB In-Reply-To: Bytes: 2769 On 09/01/2025 14:11, David Brown wrote: > On 09/01/2025 09:07, Julio Di Egidio wrote: >> On 08/01/2025 17:18, David Brown wrote: >>> On 08/01/2025 15:42, Julio Di Egidio wrote: >> >>>   So you can be confident that almost anyone using your software in >>> embedded systems will be using a 32-bit core - most likely an ARM >>> Cortex-M, but possibly RISC-V.  And they will probably be using a >>> toolchain that supports at least C17 (some people are still on older >>> toolchains), whether it is gcc, clang, or commercial.   Certainly >>> solid C99 support is guaranteed.  Everything else is niche, and no >>> one will be using your software on niche systems. >> >> Even my fridge should be able to run it...  I am writing a Prolog >> compiler, but more generally I'd be mostly writing algorithms-data >> structures things. >> >> That said, one thing nobody has been explaining is why C99 is superior >> to C89/C90, except for some coding conveniences as far as I have read >> online: and I must say here that I do prefer the good old ways, >> including style-wise, in most cases... >> > > The C99 features that I consider to make code easier to write, clearer, > safer, more portable, more efficient, and generally better are: > >     compound literals >     designated initialisers >     mixing declaration and code >     variadic macros Funny, I usually find code using such features less clear! They would also make programs a little less portable, since they now rely on an implementation that includes support.