🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #758

Re: variadic min and max, (any some and none, cat and more)

#758
From: fir
Date: Sun, 25 Oct 2026 11:01
45 lines
2296 bytes
ichard Harnden pisze:> 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}));
 >
 >
 >
such thig should be builtin nd automatic there are hovever some 
decisions toconclude for example

foo(float3 x);
goo(float3* x);

foo({1,2,4.});

goo({2,3,4}) or  goo(&{2,3,4})

or maybe allowing to drop {} at all
foo(1,2,4.);

though the last one sem risky..though the vararg talks before suggest it
is an option
Technical Details
Message-ID: <11bknhr$3hf2m$2@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-mail
References: <11bes8b$1gncr$1@dont-email.me> <11bk09r$3acgl$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: fir <profesor.fir@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: variadic min and max, (any some and none, cat and more)
Date: Sun, 25 Oct 2026 12:01:14 +0100
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <11bknhr$3hf2m$2@dont-email.me>
References: <11bes8b$1gncr$1@dont-email.me> <11bk09r$3acgl$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 25 Oct 2026 11:01:15 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3718230"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/GfOR2mDjNcqjNrQXXXkBRxbSbTPxpo6A="; posting-host="025215e21887b0384e3fa1d5b78a3ebb"
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:TWQMT3oObU78k7CpvwaycnO25j4= sha256:wY7J40i00m7vjvRQzzSsvgdicSxFfdfyvaB9PQtn+m8=
	sha1:6MzXTtKOw84egosBvW/0PY7E138= sha256:B+yj+aXczR9j4dlZMuAy2494ZyYGPTvU3W+M4FH8IRo=
In-Reply-To: <11bk09r$3acgl$1@dont-email.me>