Article View: comp.lang.c
Article #739Re: variadic min and max, (any some and none, cat and more)
From: fir
Date: Sat, 24 Oct 2026 13:23
Date: Sat, 24 Oct 2026 13:23
48 lines
3385 bytes
3385 bytes
David Brown pisze: > 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. > > im not quite understand what you say here (wak english) but theis "shallow varargs" with N passed via register could be quite usable like for min max for example min(a,b,c,d,e) you just write a function min bodli like for min(int*t) but you just have nice interface for all that tiny cases where you searh min in short cases like 2,3,4,5,6,7,8,6 arguments in comparsion to predefined versions for 2/3 arguments it would be a bit slower maybe but not so much, overally i find it rather usefull
Technical Details
Message-ID:
<11bibgc$2nvgl$1@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> <11bfs35$1ojh8$4@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: fir <profesor.fir@gmail.com> Newsgroups: comp.lang.c Subject: Re: variadic min and max, (any some and none, cat and more) Date: Sat, 24 Oct 2026 15:23:22 +0200 Organization: A noiseless patient Spider Lines: 48 Message-ID: <11bibgc$2nvgl$1@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> <11bfs35$1ojh8$4@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sat, 24 Oct 2026 13:23:24 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2883093"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+p4R5gazfm9y3yYKVHUFoqTW+dhlMTThU="; posting-host="b285b74d6a7e1db326de4fb86ea26fbc" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0 SeaMonkey/2.53.24 Cancel-Lock: sha1:IjSv5MI9rDA7SdNH58ACu+reLl4= sha256:ka1Pe5u8l3qYXenqJSip9Vbwx71/evmoZEW5RO/T4Rw= sha1:RyfiqegTtzOeT5hSXuYOcAy6rek= sha256:xPRXG99MJVnWMmlb8/H++grrGbWuFIawNdR+xVGBMGQ= In-Reply-To: <11bfs35$1ojh8$4@dont-email.me>