Article View: comp.lang.c
Article #753Re: variadic min and max, (any some and none, cat and more)
From: Richard Harnden
Date: Sun, 25 Oct 2026 04:24
Date: Sun, 25 Oct 2026 04:24
31 lines
1843 bytes
1843 bytes
On 23/10/2026 06:44, fir wrote:
> when thinkong on variadic functions not much come to mind but
> only recently i noticed min or max would be good for variadic
>
> the ai wrote me such variadic min
I don't think that I'd bother with stdarg at all.
Just use a string of ints ...
int min(const int *n)
{
int m = INT_MAX;
while ( *n )
{
if ( *n < m ) m = *n;
n++;
}
return m;
}
> int a=Min(4,10,3,7,-2); // -2
int a = min((int[]){10,3,7,-2}));
Technical Details
Message-ID:
<11bk09r$3acgl$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>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: Richard Harnden <richard.nospam@gmail.invalid> Newsgroups: comp.lang.c Subject: Re: variadic min and max, (any some and none, cat and more) Date: Sun, 25 Oct 2026 04:24:26 +0000 Organization: A noiseless patient Spider Lines: 31 Message-ID: <11bk09r$3acgl$1@dont-email.me> References: <11bes8b$1gncr$1@dont-email.me> Reply-To: nospam.harnden@invalid.com MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 25 Oct 2026 04:24:28 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3486229"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18v1u7bsPuwccYIz9SdiZ8THk9EVVZxfb4="; posting-host="fd20cf620dd88f4b3283dd77438f024c" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:z19lGwNsy+OSUzZGJWPOe5dvvdQ= sha256:7piwwVV0dKrUXtBCo8gzYxj3OrMS0xRIVvodpjswup4= sha1:efZ/ZIRs0N1Nswdhr0R4tKN9GkA= sha256:5RjTYMRys/06yZbfjcWd3e1rQyT3E85NCbS7niss4UM= Content-Language: en-GB In-Reply-To: <11bes8b$1gncr$1@dont-email.me>