Article View: comp.lang.c
Article #717Re: variadic min and max, (any some and none, cat and more)
From: David Brown
Date: Fri, 23 Oct 2026 14:48
Date: Fri, 23 Oct 2026 14:48
31 lines
2725 bytes
2725 bytes
On 23/10/2026 16:29, bartc wrote: > On 23/10/2026 14:18, David Brown wrote: >> On 23/10/2026 14:53, bartc wrote: > >>> OK. I'm don't know how to do solutions with macros. It is a harder >>> language than C. Complex macros can be hairy. When they are used for things significantly more advanced than envisioned when the C pre-processor was conceived, and you don't often work with such macros, the results can be hard to write and hard to understand. But they can still be useful, and they can still be fun! >> >> (I hope that in the future, you remember that I called your solution, >> albeit with a macro for a slightly nicer interface, "not bad". And >> remember also that I am Scottish - "not bad" is as complimentary as we >> get!) > > I had to read it again. I assumed you were talking only about your > version not mine! It was your list version. I improved it by using a macro so that the calling syntax was nicer and the sentinel was not needed. None of this - your code or mine - is revolutionary or innovative, and there are endless examples of similar code online. But I preferred your use of a list to fir's use of va_args, with the compound initialiser being the key to usability.
Technical Details
Message-ID:
<11bfs35$1ojh8$4@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11bes8b$1gncr$1@dont-email.me> <11bf84v$1jkb5$1@dont-email.me> <11bfdcs$1mvrv$1@dont-email.me> <11bfhl3$1ojh8$1@dont-email.me> <11bflcp$1q9v8$1@dont-email.me> <11bfmqq$1ojh8$3@dont-email.me> <11bfr0q$1sivj$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: David Brown <david.brown@hesbynett.no> Newsgroups: comp.lang.c Subject: Re: variadic min and max, (any some and none, cat and more) Date: Fri, 23 Oct 2026 16:48:05 +0200 Organization: A noiseless patient Spider Lines: 31 Message-ID: <11bfs35$1ojh8$4@dont-email.me> References: <11bes8b$1gncr$1@dont-email.me> <11bf84v$1jkb5$1@dont-email.me> <11bfdcs$1mvrv$1@dont-email.me> <11bfhl3$1ojh8$1@dont-email.me> <11bflcp$1q9v8$1@dont-email.me> <11bfmqq$1ojh8$3@dont-email.me> <11bfr0q$1sivj$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 23 Oct 2026 14:48:06 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1855016"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18mfBBQcQ/Oypq1K3UaEzaSvFQPnJ9Ch6Q="; posting-host="7400fcdb32ce88f15c58e9bcb96ebcf6" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:8O85h4tIxgJeVyD2OyJw+BPcHv4= sha256:r6y1rPC/+SnTeybGcCp08vTpER8ABLA9OGHPe/kFBoc= sha1:L41Z3ihDqzfu4uJg8BzA4ucesxo= sha256:YGnRb+fi+BcgoSiX7ziGpK/85rRYWRtnIjJ2PWE76Qo= Content-Language: en-GB, nb-NO In-Reply-To: <11bfr0q$1sivj$1@dont-email.me>