Article View: comp.lang.c
Article #772Re: variadic min and max, (any some and none, cat and more)
From: Chris M. Thomasson
Date: Sun, 25 Oct 2026 22:59
Date: Sun, 25 Oct 2026 22:59
108 lines
4319 bytes
4319 bytes
On 10/25/2026 1:49 PM, Chris M. Thomasson wrote:
> On 10/25/2026 11:04 AM, fir wrote:
>> fir pisze:
>>> bartc pisze:
>>>> On 25/10/2026 11:01, fir wrote:
>>>>> 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.);
>>>>
>>>> So:
>>>>
>>>> foo(float3 x, float3 y, int n);
>>>>
>>>> can be called as:
>>>>
>>>> foo(1, 2, 3, 4, 5, 6, 7);
>>>>
>>>
>>> well its a question what to put as a mandatory.. i dont know yet, but
>>> for sure thise automatic 'fitting' would be somewhat good
>>>
>>> some can write
>>>
>>> foo({1, 2, 3}, {4, 5, 6}, 7);
>>>
>>> and you again present anti-c philosophy
>>>
>>> c allows you write programs ale obfuscated c contests..in your philosofy
>>> you would forbide it all? forcing codes not have syttaktic shortcuts?
>>>
>>> i totally not agree to such philosophy
>>>
>>> (though its not always clear whay s good shortcut/hack c way and what
>>> is not)
>>>
>>>
>>>
>>>> It's so easy to see where one argument ends and another begins! And
>>>> this is the simplest possible set of arguments.
>>>>
>>>> Still, C has prior art here:
>>>>
>>>> typedef struct {float x,y,z;} float3;
>>>> typedef struct {float3 a, b; int c;} T;
>>>>
>>>> T x = {1, 2, 3, 4, 5, 6, 7};
>>>>
>>>> So that would fit right in!
>>>>
>>>>
>>>
>> recent state of my rasterizer toying btw
>>
>> https://www.youtube.com/watch?v=xERLKVTV9s8
Not bad.
>>
>> those pices of geometry was generated by ai ...sadly when adding more
>> geometry the rasterizer get slowing down ofs..and i have no best cpu
>
> Too bad you need an AI to make it for you.
>
>>
>> though modern are maybe 2-3 times faster at most i guess
>
Technical Details
Message-ID:
<11bm1ki$21t2$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-mailReferences:
<11bes8b$1gncr$1@dont-email.me> <11bk09r$3acgl$1@dont-email.me> <11bknhr$3hf2m$2@dont-email.me> <11bkrcn$3j1k3$1@dont-email.me> <11bkuc9$3k4ud$1@dont-email.me> <11blgaj$3r91q$1@dont-email.me> <11blq1h$3v8r7$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: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> Newsgroups: comp.lang.c Subject: Re: variadic min and max, (any some and none, cat and more) Date: Sun, 25 Oct 2026 15:59:30 -0700 Organization: A noiseless patient Spider Lines: 108 Message-ID: <11bm1ki$21t2$2@dont-email.me> References: <11bes8b$1gncr$1@dont-email.me> <11bk09r$3acgl$1@dont-email.me> <11bknhr$3hf2m$2@dont-email.me> <11bkrcn$3j1k3$1@dont-email.me> <11bkuc9$3k4ud$1@dont-email.me> <11blgaj$3r91q$1@dont-email.me> <11blq1h$3v8r7$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sun, 25 Oct 2026 22:59:31 +0000 (UTC) Injection-Info: dont-email.me; logging-data="67490"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/qaIX069x3/g+9fBVTtdxQ7RIkUsTxqFE="; posting-host="792908fec4aa45dbc14a04382b76f62a" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:aS73v9+BEvn1E31abE+I8tVn4ss= sha256:2laP103zkCnUiRVwJS5YQlcHu6NzE88LXBFlyXbJGQM= sha1:mDMCx7OuHkWXUEgTYFY6K/h4yE4= sha256:ijn8z4zGkqrraoy8arPG5aJgQi+k3pq99pXBfKwyaGY= In-Reply-To: <11blq1h$3v8r7$1@dont-email.me> Content-Language: en-US