🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #778

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

#778
From: fir
Date: Mon, 26 Oct 2026 11:30
179 lines
8105 bytes
fir pisze:
> Chris M. Thomasson pisze:
>> On 10/25/2026 5:32 PM, fir wrote:
>>> Chris M. Thomasson pisze:
>>>> 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
>>>>>
>>>>> 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.
>>>>
>>>
>>>
>>> you talk like medevial peasnt such your remarks here
>>>
>>> you know for some people accustomed to higher social standards you 
>>> may be perceive you as a bit of a country bumpkin (sorry i dont 
>>> understand this phrase its form translation, i m not quite sure what 
>>> bumpkin is - i meant more like peasent, medevial villager)
>>>
>>> its not quite good to enforce you peasnty belifs on 
>>> people...especially as it seems you totally dont know what youre 
>>> talkin about
>>>
>>> i already told you so but it seems youre like dont get it
>>>
>>>
>>> as to rasterizer its nice to shape the pixell matter..though i need much
>>> stronger cpu, i need like 100x stronger..and it doesnt seem i would 
>>> get it..though GPU in fact maybe might be so
>>>
>>> or meybe i should learn more multithreading and put it on 8 10 or 12
>>> cores... im not sure but not being experienced in this it seems that 
>>> rasterisation should be quite good for multithreading - simply run 1/10
>>> of objects in the scene on 10 cores into 10 output buffers..then "add"
>>> the buffers... this depth buffers seem ideal for adding
>>>
>>> im not yet sure if it really works that way - but if it does its 
>>> finally a reason to buy a desktop pc iwth many cores
>>>
>>>
>>>
>>>>>
>>>>> though modern are maybe 2-3 times faster at most i guess
>>>>
>>>
>>
>> Not really, just buy something with a half way decent GPU, or even a 
>> crappy one. NVIDIA has some cheap ones. The learn how to code for it.
> 
> there is no chea nvidia GPU at stores right now.. i maybe should stil 
> wait if they get nootably cheaper and buy some
> 
> more important gpu koding is different kind of coding... this rasterizer 
> btw i coded in formal C now (as ported from old version c via c++) 
> though those linker errors when i
>   i call i function name which i it cant find annoys me i could say
> (in c via c++ thre eas no such thing as i remember)
> 
> 
> as to AI it so much grat i could probably name a list of 100
> (or at least 30) big advantages of it where 2-3 could be suffice to use it
> 
> you noticed i criticize your 'peasenty' attitude but really learn what 
> you talkin about becouse stating things when you got no idea what youre 
> talkin about is absolutely not usenet is for
> 
> usenet was always good people here focus on validating opinions and
> what you say   like that: i have no idea what im talking about yet i 
> will say opposite to truth is not standable  here
> 
> take given point you learned if something is wrong in that point 
> criticize it in valid ay if you must ... or praise it if its good 
> becouse this seconnd attempt is arso quite valueable i such new topic 
> when people need to learn that
> 
dont know how to do it - download chatgpt from windows store or 
(slightly worse imo) open t in web and ask the programming speific 
questions you will be impressed 0 instead of talkin bulshit on
the net as many do

(ofc paying questions may be a problem but now yhe free versions go on 
quite well - and i hope it will stay this way becouse if those firms use 
so much public material made by anybody they should be obliged to return 
part of it as free decend versions im (it should be even regulated by 
law maybe as some kind of payback to society... but for now its ok)
Technical Details
Message-ID: <11bndl5$hac1$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> <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> <11bm73g$3odm$1@dont-email.me> <11bme1a$5v21$1@dont-email.me> <11bndem$hac1$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: Mon, 26 Oct 2026 12:30:39 +0100
Organization: A noiseless patient Spider
Lines: 179
Message-ID: <11bndl5$hac1$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> <11bm73g$3odm$1@dont-email.me>
 <11bme1a$5v21$1@dont-email.me> <11bndem$hac1$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 26 Oct 2026 11:30:45 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="567681"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19ucvdy9RrPHYjZ1qyY0RQhlXsqARe4nzM="; posting-host="524fd3863234ce524468884467e01d13"
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:2M3mZUIoEAZ7e6iKtcaDN9bqGvQ= sha256:DMlaqcaPRjZshdokP4YhRVvmuSRtWajerpsqdnwMBzg=
	sha1:oZDoUNlmgrlMqDTBPi0LGqrcXIw= sha256:oMb4S5hq5qohCmv4VljYj5OUMfeT72vs812OGHIag9k=
In-Reply-To: <11bndem$hac1$1@dont-email.me>