🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

101 total messages Page 1 of 2 Started by fir Fri, 23 Oct 2026 05:44
Page 1 of 2 • 101 total messages
variadic min and max, (any some and none, cat and more)
#692
Author: fir
Date: Fri, 23 Oct 2026 05:44
82 lines
2868 bytes
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

#include <stdarg.h>

int Min(int count,...)
{
va_list args;
va_start(args,count);

```
int min=va_arg(args,int);
for(int i=1;i<count;i++)
{
     int x=va_arg(args,int);
     if(x<min) min=x;
}

va_end(args);
return min;
}


to use

int a=Min(4,10,3,7,-2);  // -2
int b=Min(3,15,8,12);    // 8
int c=Min(1,42);         // 42


problem is imo this leading argument n, imo it should

just be called

min(34,34,2);

thus the variadic support probably need to change


imo it would be better if compiler would jut provide for user such things as


*arg - (or *args?) (the ram block of arguments with size sizeof(*arg))

afg[0], arg[1], arg[2] - arguments vakues

arg - pointer to *arg

arg_n - how many



possible two version of variadic should be present one is this
'unitary' when all args are same type like array of ints
and this non unitary where any arg can have a different type then
some king of typeof(arg[2]) operator should be probably
added


i guess such unitary variadic should just work close to an array
pasing (like pasing by int*  for example

foo(int* arg)
{

}


but with hidden arg_n passed (not via stack probably by register, unless 
arrays are overally passed with size)

and with functionality to call it in place

ike foo(2,3,4,1,3,4)

whiuch in case of things like min max could be handy

thou it need to be rethinked yet

Re: variadic min and max, (any some and none, cat and more)
#700
Author: David Brown
Date: Fri, 23 Oct 2026 09:07
145 lines
5971 bytes
On 23/10/2026 07: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
> 
> #include <stdarg.h>
> 
> int Min(int count,...)
> {
> va_list args;
> va_start(args,count);
> 
> ```
> int min=va_arg(args,int);
> for(int i=1;i<count;i++)
> {
>      int x=va_arg(args,int);
>      if(x<min) min=x;
> }
> 
> va_end(args);
> return min;
> }
> 
> 
> to use
> 
> int a=Min(4,10,3,7,-2);  // -2
> int b=Min(3,15,8,12);    // 8
> int c=Min(1,42);         // 42
> 
> 
> problem is imo this leading argument n, imo it should
> 
> just be called
> 
> min(34,34,2);
> 
> thus the variadic support probably need to change
> 
> 
> imo it would be better if compiler would jut provide for user such 
> things as
> 
> 
> *arg - (or *args?) (the ram block of arguments with size sizeof(*arg))
> 
> afg[0], arg[1], arg[2] - arguments vakues
> 
> arg - pointer to *arg
> 
> arg_n - how many
> 
> 

Variadic functions have no way of counting their arguments, or 
identifying their types.  This can't be changed easily - it is built 
into the way C functions are called (in pretty much every 
implementation).  The caller simply puts the arguments into registers or 
onto the stack according to the ABI for the target, then calls the 
function.  The function has to /know/ the number and type of the 
arguments - that cannot be determined automatically.

This knowledge usually comes from one of two sources.  One is from the 
first argument - such as you use above, providing the number of 
arguments explicitly, or the format argument for "printf".  The second 
is by using a sentinel - a special end value.

Variadic functions are naturally very fragile, and the compiler cannot 
help spot mismatches (except in well-known cases, like printf).

So it is not a case of "variadic function support needs to change" - it 
simply cannot be fixed within the C function model.

Variadic macros are in some ways better, though they have their own 
challenges and limitations.  In particular, you can't loop, they can't 
be recursive, you can't count the number the number of arguments 
directly, and solutions to these evaluate the arguments multiple times. 
But with enough effort, it is possible to handle this - there are plenty 
of blogs with creative solutions.  (Jens Gustedt has several good articles.)

If I wanted to write such a variadic minimum function, I would do so 
using a sentinel, with a macro to add the sentinel:

#define SENTINEL INT_MIN
#define min(x0, ...) min_func(x0 __VA_OPT__(,) __VA_ARGS__, SENTINEL)

int min_func(int x0, ...) {
     va_list args;
     va_start(args);

     int m = x0;
     while (true) {
         int x = va_arg(args, int);
         if (x == SENTINEL) return m;
         if (x < m) m = x;
     }
}


It is up to the user to ensure that the arguments to "min" are all ints, 
and none of them match the sentinel value.

This code uses a C23 feature __VA_OPT__ which can be avoided using a gcc 
extension or some more complex macros.  It also uses the C23 feature of 
va_start() without additional arguments.  If you don't want C23, you can 
therefore use :

#define min(x0, ...) min_func(x0, ## __VA_ARGS__, SENTINEL)

     va_start(args, x0);

But the C23 features make it slightly neater.



None of this means I think a variadic function here is a good idea.  A 
full variadic macro solution is probably better, but somewhat messy, 
complex (when you haven't done it before), and always has a fixed limit 
on the maximum number of elements.

A good solution could not be done by changing variadic functions in C 
without a massive and disruptive change to the function model.  It 
cannot be done by changing variadic macros in C without a massive and 
disruptive change to the macro model.  It would need something else - a 
variadic template solution that is always expanded inline (somewhat like 
a macro), but is not text-based like pre-processor macros so that you 
can get recursion or loops.  Adding that to C would be a huge job - so 
you either stick to the limitations of variadic macros in C, or switch 
to C++.

template <typename T>
constexpr auto min(T x0) { return x0; }

template <typename T, typename U>
constexpr auto min(T x0, U x1) { return (x0 < x1) ? x0 : x1; }

template <typename T, typename U, typename... Args>
constexpr auto min(T x0, U x1, Args... args) {
     return min(x0, min(x1, args...));
}

(Here you can use any types that make sense, not just int.)
Re: variadic min and max, (any some and none, cat and more)
#703
Author: bartc
Date: Fri, 23 Oct 2026 10:37
84 lines
3994 bytes
On 23/10/2026 10:07, David Brown wrote:
> On 23/10/2026 07: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

> Variadic functions have no way of counting their arguments, or 
> identifying their types.  This can't be changed easily - it is built 
> into the way C functions are called (in pretty much every 
> implementation).  The caller simply puts the arguments into registers or 
> onto the stack according to the ABI for the target,

At last somebody who knows what ABI means.

> If I wanted to write such a variadic minimum function, I would do so 
> using a sentinel, with a macro to add the sentinel:
> 
> #define SENTINEL INT_MIN
> #define min(x0, ...) min_func(x0 __VA_OPT__(,) __VA_ARGS__, SENTINEL)
> 
> int min_func(int x0, ...) {
>      va_list args;
>      va_start(args);
> 
>      int m = x0;
>      while (true) {
>          int x = va_arg(args, int);
>          if (x == SENTINEL) return m;
>          if (x < m) m = x;
>      }
> }
> 
> 
> It is up to the user to ensure that the arguments to "min" are all ints, 
> and none of them match the sentinel value.
> 
> This code uses a C23 feature __VA_OPT__ which can be avoided using a gcc 
> extension or some more complex macros.  It also uses the C23 feature of 
> va_start() without additional arguments.  If you don't want C23, you can 
> therefore use :
> 
> #define min(x0, ...) min_func(x0, ## __VA_ARGS__, SENTINEL)
> 
>      va_start(args, x0);
> 
> But the C23 features make it slightly neater.
> 
> 
> 
> None of this means I think a variadic function here is a good idea. 

For this purpose, where all elements are expected to be the same type, 
then passing a list is more appropriate, and more type-safe. Especially 
when 'min_func' has a specific return type anyway.

Example:

  #include <stdio.h>
  #include <limits.h>

  int min(int* list) {
      enum {sentinel = 0};
      int result = INT_MAX;

      while (*list != sentinel) {
         if (*list < result) result = *list;
          ++list;
      }

      return result;
  }

  int main(){
      printf("%d\n", min((int[]){3,1,4,1,5,9,2,6,0}));
  }

Although a tidier way of imparting the length is better. It depends on 
whether the common use-case is a small fixed number of elements, or an 
arbitrary array (where the length is likely in some variable.)

An even simpler way where the number of elements is small and is known, 
is to just write dedicated functions such as min2(x, y) and min3(x, y, 
z). The first will be by far the most common need IME.

Re: variadic min and max, (any some and none, cat and more)
#704
Author: David Brown
Date: Fri, 23 Oct 2026 11:49
129 lines
5708 bytes
On 23/10/2026 12:37, bartc wrote:
> On 23/10/2026 10:07, David Brown wrote:
>> On 23/10/2026 07: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
> 
>> Variadic functions have no way of counting their arguments, or 
>> identifying their types.  This can't be changed easily - it is built 
>> into the way C functions are called (in pretty much every 
>> implementation).  The caller simply puts the arguments into registers 
>> or onto the stack according to the ABI for the target,
> 
> At last somebody who knows what ABI means.

Note that an "ABI" encompasses many things - calling convention(s) are 
just one (albeit important) part of it.

> 
>> If I wanted to write such a variadic minimum function, I would do so 
>> using a sentinel, with a macro to add the sentinel:
>>
>> #define SENTINEL INT_MIN
>> #define min(x0, ...) min_func(x0 __VA_OPT__(,) __VA_ARGS__, SENTINEL)
>>
>> int min_func(int x0, ...) {
>>      va_list args;
>>      va_start(args);
>>
>>      int m = x0;
>>      while (true) {
>>          int x = va_arg(args, int);
>>          if (x == SENTINEL) return m;
>>          if (x < m) m = x;
>>      }
>> }
>>
>>
>> It is up to the user to ensure that the arguments to "min" are all 
>> ints, and none of them match the sentinel value.
>>
>> This code uses a C23 feature __VA_OPT__ which can be avoided using a 
>> gcc extension or some more complex macros.  It also uses the C23 
>> feature of va_start() without additional arguments.  If you don't want 
>> C23, you can therefore use :
>>
>> #define min(x0, ...) min_func(x0, ## __VA_ARGS__, SENTINEL)
>>
>>      va_start(args, x0);
>>
>> But the C23 features make it slightly neater.
>>
>>
>>
>> None of this means I think a variadic function here is a good idea. 
> 
> For this purpose, where all elements are expected to be the same type, 
> then passing a list is more appropriate, and more type-safe. Especially 
> when 'min_func' has a specific return type anyway.
> 
> Example:
> 
>   #include <stdio.h>
>   #include <limits.h>
> 
>   int min(int* list) {
>       enum {sentinel = 0};
>       int result = INT_MAX;
> 
>       while (*list != sentinel) {
>          if (*list < result) result = *list;
>           ++list;
>       }
> 
>       return result;
>   }
> 
>   int main(){
>       printf("%d\n", min((int[]){3,1,4,1,5,9,2,6,0}));
>   }
> 
> Although a tidier way of imparting the length is better. It depends on 
> whether the common use-case is a small fixed number of elements, or an 
> arbitrary array (where the length is likely in some variable.)

It could be combined with a macro :

int min_list(size_t n, const int * list) {
     int m = list[0];
     for (size_t i = 1; i < n; i++) {
         if (list[i] < m) m = list[i];
     }
     return m;
}

#define min(...) min_list( \
	sizeof((int []) { __VA_ARGS__ }) / sizeof(int), \
         int []) { __VA_ARGS__ })

Then it can be called with just :

         printf("%d\n", min(3, 1, 4, 1, 5, 9, 2, 6, 0));

Not a bad solution, when a single fixed type will do.

> 
> An even simpler way where the number of elements is small and is known, 
> is to just write dedicated functions such as min2(x, y) and min3(x, y, 
> z). The first will be by far the most common need IME.
> 

You can take this a step further - here using macros so that it works 
for any suitable type :

#define min2(a, b) (((a) < (b)) ? (a) : (b))
#define min3(a, b, c) min2(a, min2(b, c))
#define min4(a, b, c, d) min2(min2(a, b), min2(c, d))
#define min5(a, b, c, d, e) min2(min2(a, b), min3(c, d, e))
#define min_arg(a, b, c, d, e, ...) min5(a, b, c, d, e)
#define min(a, ...) min_arg(__VA_ARGS__ __VA_OPT__(,) a, a, a, a, a, a)

The first 5 are just "normal" fixed argument minX macros of different 
sizes.  Then we make a variadic macro "min" that passes on the arguments 
it is given, with extra copies of "a" so that min5 can always be called, 
along with an intermediary "min_arg" to absorb any unnecessary extra 
arguments.

(Again, I am not saying I recommend any of this, but it can be fun to 
play around with.)
Re: variadic min and max, (any some and none, cat and more)
#707
Author: fir
Date: Fri, 23 Oct 2026 12:42
36 lines
2065 bytes
David Brown pisze:
> Variadic functions have no way of counting their arguments, or 
> identifying their types.


this is silly becouse it cos t one register to use so its totally not a 
problem


the case with various type arguments is much harder but the one with
"all ints" etc is quite easy


simpl as i said the user need the arg[] and arg_max avaliable


foo(int ...v)
{
  for(int i=0; i<sizeof(v)/sizeof(int); i++)
{

}

}

i dont know maybe just same syntax can be used

foo(int[] v)
{

}

so you can put foo(tab) or foo(2,3,4,2,32,3,23,2) at will
thou this version would pass via pointer and is someone need to pass by 
stack probably would need to use f(int ...)  version
Re: variadic min and max, (any some and none, cat and more)
#709
Author: bartc
Date: Fri, 23 Oct 2026 12:53
94 lines
4997 bytes
On 23/10/2026 12:49, David Brown wrote:
> On 23/10/2026 12:37, bartc wrote:
>> On 23/10/2026 10:07, David Brown wrote:
>>> On 23/10/2026 07: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
>>
>>> Variadic functions have no way of counting their arguments, or 
>>> identifying their types.  This can't be changed easily - it is built 
>>> into the way C functions are called (in pretty much every 
>>> implementation).  The caller simply puts the arguments into registers 
>>> or onto the stack according to the ABI for the target,
>>
>> At last somebody who knows what ABI means.
> 
> Note that an "ABI" encompasses many things - calling convention(s) are 
> just one (albeit important) part of it.

But it is little to do with APIs other than those tend to get mixed up.


>> Although a tidier way of imparting the length is better. It depends on 
>> whether the common use-case is a small fixed number of elements, or an 
>> arbitrary array (where the length is likely in some variable.)
> 
> It could be combined with a macro :
> 
> int min_list(size_t n, const int * list) {
>      int m = list[0];
>      for (size_t i = 1; i < n; i++) {
>          if (list[i] < m) m = list[i];
>      }
>      return m;
> }
> 
> #define min(...) min_list( \
>      sizeof((int []) { __VA_ARGS__ }) / sizeof(int), \
>          int []) { __VA_ARGS__ })
> 
> Then it can be called with just :
> 
>          printf("%d\n", min(3, 1, 4, 1, 5, 9, 2, 6, 0));

(Is that 0 still a sentinel here? If so it would anyway be better as as 
INT_MAX or some nicer alias.)

> Not a bad solution, when a single fixed type will do.

OK. I'm don't know how to do solutions with macros. It is a harder 
language than C.

>> An even simpler way where the number of elements is small and is 
>> known, is to just write dedicated functions such as min2(x, y) and 
>> min3(x, y, z). The first will be by far the most common need IME.
>>
> 
> You can take this a step further - here using macros so that it works 
> for any suitable type :
> 
> #define min2(a, b) (((a) < (b)) ? (a) : (b))
> #define min3(a, b, c) min2(a, min2(b, c))
> #define min4(a, b, c, d) min2(min2(a, b), min2(c, d))
> #define min5(a, b, c, d, e) min2(min2(a, b), min3(c, d, e))
> #define min_arg(a, b, c, d, e, ...) min5(a, b, c, d, e)
> #define min(a, ...) min_arg(__VA_ARGS__ __VA_OPT__(,) a, a, a, a, a, a)
> 
> The first 5 are just "normal" fixed argument minX macros of different 
> sizes.  Then we make a variadic macro "min" that passes on the arguments 
> it is given, with extra copies of "a" so that min5 can always be called, 
> along with an intermediary "min_arg" to absorb any unnecessary extra 
> arguments.


> (Again, I am not saying I recommend any of this, but it can be fun to 
> play around with.)

The problem I have with this is use-cases.

I feel that a special solution for N-way min(), where N is a small 
compile-time value, is as useful as an N-way solution for 'add'.

It can happen, but in the case of 'add', you just write x + y + z, you 
don't need +(x, y, z).

So for min, it would be min(x, min(y, z)) which is not too onerous.

(But if 'min' was an operator that can be used in-fix style as well as 
function-like [I do this], then this would also be x min y min z.

Of course, in a higher level language you can have a solution based on 
using 'reduce(min, x)' where 'min' works on two operands, and x is a 
list. But this would be a poor fit here.)

Re: variadic min and max, (any some and none, cat and more)
#710
Author: David Brown
Date: Fri, 23 Oct 2026 12:56
16 lines
1901 bytes
On 23/10/2026 14:42, fir wrote:
> David Brown pisze:
>> Variadic functions have no way of counting their arguments, or 
>> identifying their types.
> 
> 
> this is silly becouse it cos t one register to use so its totally not a 
> problem
> 
> 
It doesn't matter whether you think this is "silly" or not.  It is a 
fact of the way variadic functions work in C, which goes back to the way 
all functions have always worked in C.  The called variadic function has 
no way to determine the number of arguments - the information is lost by 
then.
Re: variadic min and max, (any some and none, cat and more)
#711
Author: fir
Date: Fri, 23 Oct 2026 12:57
53 lines
2442 bytes
fir pisze:
> David Brown pisze:
>> Variadic functions have no way of counting their arguments, or 
>> identifying their types.
> 
> 
> this is silly becouse it cos t one register to use so its totally not a 
> problem
> 
> 
> the case with various type arguments is much harder but the one with
> "all ints" etc is quite easy
> 
> 
> simpl as i said the user need the arg[] and arg_max avaliable
> 
> 
> foo(int ...v)
> {
>   for(int i=0; i<sizeof(v)/sizeof(int); i++)
> {
> 
> }
> 
> }
> 


so as its show in this all one type case you dont need  any varargs macros

foo (int n, ...) {}


in fact you dont need nothing may just acces via n[i] above all you need
it to pass in register the max_n value (or size of args block)






> i dont know maybe just same syntax can be used
> 
> foo(int[] v)
> {
> 
> }
> 
> so you can put foo(tab) or foo(2,3,4,2,32,3,23,2) at will
> thou this version would pass via pointer and is someone need to pass by 
> stack probably would need to use f(int ...)  version
> 
Re: variadic min and max, (any some and none, cat and more)
#712
Author: fir
Date: Fri, 23 Oct 2026 13:00
21 lines
2209 bytes
David Brown pisze:
> On 23/10/2026 14:42, fir wrote:
>> David Brown pisze:
>>> Variadic functions have no way of counting their arguments, or 
>>> identifying their types.
>>
>>
>> this is silly becouse it cos t one register to use so its totally not 
>> a problem
>>
>>
> It doesn't matter whether you think this is "silly" or not.  It is a 
> fact of the way variadic functions work in C, which goes back to the way 
> all functions have always worked in C.  The called variadic function has 
> no way to determine the number of arguments - the information is lost by 
> then.
> 
it does mayer - you may tray to prove it doesnt matter ;c

im not sayin it not work thsi way that the information is not provided
client side 9maybe) not im saying its silly not to provide it
Re: variadic min and max, (any some and none, cat and more)
#714
Author: David Brown
Date: Fri, 23 Oct 2026 13:18
123 lines
6543 bytes
On 23/10/2026 14:53, bartc wrote:
> On 23/10/2026 12:49, David Brown wrote:
>> On 23/10/2026 12:37, bartc wrote:
>>> On 23/10/2026 10:07, David Brown wrote:
>>>> On 23/10/2026 07: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
>>>
>>>> Variadic functions have no way of counting their arguments, or 
>>>> identifying their types.  This can't be changed easily - it is built 
>>>> into the way C functions are called (in pretty much every 
>>>> implementation).  The caller simply puts the arguments into 
>>>> registers or onto the stack according to the ABI for the target,
>>>
>>> At last somebody who knows what ABI means.
>>
>> Note that an "ABI" encompasses many things - calling convention(s) are 
>> just one (albeit important) part of it.
> 
> But it is little to do with APIs other than those tend to get mixed up.

If you want to argue about ABIs and APIs, go back to the thread where 
you were doing that already.  You don't have to bring up every topic 
that frustrates you or irritates you into every thread!

> 
> 
>>> Although a tidier way of imparting the length is better. It depends 
>>> on whether the common use-case is a small fixed number of elements, 
>>> or an arbitrary array (where the length is likely in some variable.)
>>
>> It could be combined with a macro :
>>
>> int min_list(size_t n, const int * list) {
>>      int m = list[0];
>>      for (size_t i = 1; i < n; i++) {
>>          if (list[i] < m) m = list[i];
>>      }
>>      return m;
>> }
>>
>> #define min(...) min_list( \
>>      sizeof((int []) { __VA_ARGS__ }) / sizeof(int), \
>>          int []) { __VA_ARGS__ })
>>
>> Then it can be called with just :
>>
>>          printf("%d\n", min(3, 1, 4, 1, 5, 9, 2, 6, 0));
> 
> (Is that 0 still a sentinel here? If so it would anyway be better as as 
> INT_MAX or some nicer alias.)

No, it is no longer a sentinel - it will be used directly, so the value 
printed will be 0.  (It was you that used 0 as a sentinel - in my 
earlier example, I used INT_MIN as the sentinel as that is far less 
likely to conflict with useful values.  And it was hidden in the macros.

> 
>> Not a bad solution, when a single fixed type will do.
> 
> OK. I'm don't know how to do solutions with macros. It is a harder 
> language than C.

(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!)

> 
>>> An even simpler way where the number of elements is small and is 
>>> known, is to just write dedicated functions such as min2(x, y) and 
>>> min3(x, y, z). The first will be by far the most common need IME.
>>>
>>
>> You can take this a step further - here using macros so that it works 
>> for any suitable type :
>>
>> #define min2(a, b) (((a) < (b)) ? (a) : (b))
>> #define min3(a, b, c) min2(a, min2(b, c))
>> #define min4(a, b, c, d) min2(min2(a, b), min2(c, d))
>> #define min5(a, b, c, d, e) min2(min2(a, b), min3(c, d, e))
>> #define min_arg(a, b, c, d, e, ...) min5(a, b, c, d, e)
>> #define min(a, ...) min_arg(__VA_ARGS__ __VA_OPT__(,) a, a, a, a, a, a)
>>
>> The first 5 are just "normal" fixed argument minX macros of different 
>> sizes.  Then we make a variadic macro "min" that passes on the 
>> arguments it is given, with extra copies of "a" so that min5 can 
>> always be called, along with an intermediary "min_arg" to absorb any 
>> unnecessary extra arguments.
> 
> 
>> (Again, I am not saying I recommend any of this, but it can be fun to 
>> play around with.)
> 
> The problem I have with this is use-cases.
> 
> I feel that a special solution for N-way min(), where N is a small 
> compile-time value, is as useful as an N-way solution for 'add'.
> 
> It can happen, but in the case of 'add', you just write x + y + z, you 
> don't need +(x, y, z).
> 
> So for min, it would be min(x, min(y, z)) which is not too onerous.
> 

I agree.  Min is useful sometimes, but it's not very common.  And the 
great majority of uses are probably for two values.  I expect N-way min 
turns up more in examples for discussions like this than it does in real 
code.

> (But if 'min' was an operator that can be used in-fix style as well as 
> function-like [I do this], then this would also be x min y min z.
> 
> Of course, in a higher level language you can have a solution based on 
> using 'reduce(min, x)' where 'min' works on two operands, and x is a 
> list. But this would be a poor fit here.)
> 

Higher level functions like "reduce", or variadic template functions, 
are useful features in a language.  But would be big features to add to 
a relatively small language, and I don't see them being appropriate for 
C.  Big languages, like C++ and Python, have good solutions for this (as 
do some smaller languages where the emphasis is different from C).
Re: variadic min and max, (any some and none, cat and more)
#715
Author: fir
Date: Fri, 23 Oct 2026 13:24
74 lines
2777 bytes
fir pisze:
> fir pisze:
>> David Brown pisze:
>>> Variadic functions have no way of counting their arguments, or 
>>> identifying their types.
>>
>>
>> this is silly becouse it cos t one register to use so its totally not 
>> a problem
>>
>>
>> the case with various type arguments is much harder but the one with
>> "all ints" etc is quite easy
>>
>>
>> simpl as i said the user need the arg[] and arg_max avaliable
>>
>>
>> foo(int ...v)
>> {
>>   for(int i=0; i<sizeof(v)/sizeof(int); i++)
>> {
>>
>> }
>>
>> }
>>
> 
> 
> so as its show in this all one type case you dont need  any varargs macros
> 
> foo (int n, ...) {}
> 
> 
> in fact you dont need nothing may just acces via n[i] above all you need
> it to pass in register the max_n value (or size of args block)
> 
> 
> 
> 
> 
> 
>> i dont know maybe just same syntax can be used
>>
>> foo(int[] v)
>> {
>>
>> }
>>
>> so you can put foo(tab) or foo(2,3,4,2,32,3,23,2) at will
>> thou this version would pass via pointer and is someone need to pass 
>> by stack probably would need to use f(int ...)  version
>>
> 




note it even can somewhat work in present c


void foo(int n,...)
{
   int sum = 0;
     for(int i=0; ; i++)
	{
        if( (&n)[i]== 0) break;
	sum+=(&n)[i];
	}

}

but this assumes args are all put on stack
Re: variadic min and max, (any some and none, cat and more)
#716
Author: bartc
Date: Fri, 23 Oct 2026 14:29
13 lines
1901 bytes
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.
> 
> (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!
Re: variadic min and max, (any some and none, cat and more)
#717
Author: David Brown
Date: Fri, 23 Oct 2026 14:48
31 lines
2725 bytes
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.

Re: variadic min and max, (any some and none, cat and more)
#718
Author: bartc
Date: Fri, 23 Oct 2026 15:02
59 lines
3102 bytes
On 23/10/2026 13:42, fir wrote:
> David Brown pisze:
>> Variadic functions have no way of counting their arguments, or 
>> identifying their types.
> 
> 
> this is silly becouse it cos t one register to use so its totally not a 
> problem
> 
> 
> the case with various type arguments is much harder but the one with
> "all ints" etc is quite easy
> 
> 
> simpl as i said the user need the arg[] and arg_max avaliable
> 
> 
> foo(int ...v)
> {
>   for(int i=0; i<sizeof(v)/sizeof(int); i++)
> {
> 
> }


Yes, you can create an alternative variadic solution, that doesn't 
interfere with how regular variadic functions work.

I came up with a similar idea to yours, but the parameter list looks 
like this:

    void F(int a, b, c ...) {}

So it is "c ..." not "c, ...". "c" is a variadic parameter, which is 
passed as an int array.

I never did an implementation, but the elements would be assembled into 
a buffer, not pushed, and a pointer to that buffer passed as well as the 
length. (My scheme would have been syntactic sugar for slices, which 
carry a length.)

Of course this is only where all variadic elements are the same type. 
Mixed types would need to use the existing less safe variadic scheme.

Note that current ABIs would not support a new scheme, making it harder 
to use such functions across languages and even with C implementations 
that did not support it.

In this case, an API (not ABI!) exporting such a function may need to 
express it in regular C terms. So for my example, it might be something 
like this if a separate pointer/length args are passed.

    void F(int a, b, *c, size_t clength);

Callers also wouldn't be able to do F(1, 2,  3, 4, 5), it would need to be:

   F(1, 2, (int[]){3, 4, 5}, 3);

Re: variadic min and max, (any some and none, cat and more)
#720
Author: Ike Naar
Date: Fri, 23 Oct 2026 16:40
25 lines
2007 bytes
On 2026-10-23, David Brown <david.brown@hesbynett.no> wrote:
> If I wanted to write such a variadic minimum function, I would do so 
> using a sentinel, with a macro to add the sentinel:
>
> #define SENTINEL INT_MIN
> #define min(x0, ...) min_func(x0 __VA_OPT__(,) __VA_ARGS__, SENTINEL)
>
> int min_func(int x0, ...) {
>      va_list args;
>      va_start(args);
>
>      int m = x0;
>      while (true) {
>          int x = va_arg(args, int);
>          if (x == SENTINEL) return m;
>          if (x < m) m = x;
>      }
> }
>
> It is up to the user to ensure that the arguments to "min" are all ints, 
> and none of them match the sentinel value.

If the sentinel value were changed to INT_MAX the none-match requirement
can be dropped (since INT_MAX is the identity element of the min operation
it could safely appear in the argument list).
Re: variadic min and max, (any some and none, cat and more)
#721
Author: Ike Naar
Date: Fri, 23 Oct 2026 16:47
28 lines
2198 bytes
On 2026-10-23, Ike Naar <ike@sdf.org> wrote:
> On 2026-10-23, David Brown <david.brown@hesbynett.no> wrote:
>> If I wanted to write such a variadic minimum function, I would do so 
>> using a sentinel, with a macro to add the sentinel:
>>
>> #define SENTINEL INT_MIN
>> #define min(x0, ...) min_func(x0 __VA_OPT__(,) __VA_ARGS__, SENTINEL)
>>
>> int min_func(int x0, ...) {
>>      va_list args;
>>      va_start(args);
>>
>>      int m = x0;
>>      while (true) {
>>          int x = va_arg(args, int);
>>          if (x == SENTINEL) return m;
>>          if (x < m) m = x;
>>      }
>> }
>>
>> It is up to the user to ensure that the arguments to "min" are all ints, 
>> and none of them match the sentinel value.
>
> If the sentinel value were changed to INT_MAX the none-match requirement
> can be dropped (since INT_MAX is the identity element of the min operation
> it could safely appear in the argument list).

Sorry, I was not thinking things through. Please forget that post.
Re: variadic min and max, (any some and none, cat and more)
#722
Author: David Brown
Date: Fri, 23 Oct 2026 16:54
30 lines
2415 bytes
On 23/10/2026 18:40, Ike Naar wrote:
> On 2026-10-23, David Brown <david.brown@hesbynett.no> wrote:
>> If I wanted to write such a variadic minimum function, I would do so
>> using a sentinel, with a macro to add the sentinel:
>>
>> #define SENTINEL INT_MIN
>> #define min(x0, ...) min_func(x0 __VA_OPT__(,) __VA_ARGS__, SENTINEL)
>>
>> int min_func(int x0, ...) {
>>       va_list args;
>>       va_start(args);
>>
>>       int m = x0;
>>       while (true) {
>>           int x = va_arg(args, int);
>>           if (x == SENTINEL) return m;
>>           if (x < m) m = x;
>>       }
>> }
>>
>> It is up to the user to ensure that the arguments to "min" are all ints,
>> and none of them match the sentinel value.
> 
> If the sentinel value were changed to INT_MAX the none-match requirement
> can be dropped (since INT_MAX is the identity element of the min operation
> it could safely appear in the argument list).

min(10, SENTINEL, 1) would still fail - it would stop when the sentinel 
is reached, and return 10.
Re: variadic min and max, (any some and none, cat and more)
#729
Author: chine.bleu
Date: Sat, 24 Oct 2026 10:25
20 lines
1948 bytes
fir wrote:
> problem is imo this leading argument n, imo it should
>
> just be called
>
> min(34,34,2);
>
> thus the variadic support probably need to change


The compiler cannot be certain which function calls are variadic. Old 
style function declarations are allowed which provide no information 
about arguments. You cannot change this without breaking unknown amount 
of dusty old code.

-- 
Siri Seal of Disavowal #777-000. Disavowed. Denied.  @
NO KINGS    For I desire mercy not sacrifice.       /|\
The Church of the Holey Apple .signature 5.5        / \
of Discordian Mysteries. This post insults Islam. Mohamed
Re: variadic min and max, (any some and none, cat and more)
#730
Author: chine.bleu
Date: Sat, 24 Oct 2026 10:37
19 lines
2249 bytes
bartc wrote:
> For this purpose, where all elements are expected to be the same type,
> then passing a list is more appropriate, and more type-safe. Especially
> when 'min_func' has a specific return type anyway.

In general the function argument types might not be known. An actual 
argument list might have 1 byte argument, a 17 byte argument, a 4 byte 
argument, 128 byte argument. In languages and environments where the 
type of each argument is declared, calls can pass arguments with 
specialised protocols.

Otherwise the arguments are passed usually where any C function is 
compatiable or Fortran subprogram compatiable.

-- 
Siri Seal of Disavowal #777-000. Disavowed. Denied.  @
NO KINGS    For I desire mercy not sacrifice.       /|\
The Church of the Holey Apple .signature 5.5        / \
of Discordian Mysteries. This post insults Islam. Mohamed
Re: variadic min and max, (any some and none, cat and more)
#733
Author: David Brown
Date: Sat, 24 Oct 2026 10:59
28 lines
2305 bytes
On 23/10/2026 18:47, Ike Naar wrote:
> On 2026-10-23, Ike Naar <ike@sdf.org> wrote:
>> On 2026-10-23, David Brown <david.brown@hesbynett.no> wrote:
>>> If I wanted to write such a variadic minimum function, I would do so
>>> using a sentinel, with a macro to add the sentinel:
>>>
>>> #define SENTINEL INT_MIN
>>> #define min(x0, ...) min_func(x0 __VA_OPT__(,) __VA_ARGS__, SENTINEL)
>>>
>>> int min_func(int x0, ...) {
>>>       va_list args;
>>>       va_start(args);
>>>
>>>       int m = x0;
>>>       while (true) {
>>>           int x = va_arg(args, int);
>>>           if (x == SENTINEL) return m;
>>>           if (x < m) m = x;
>>>       }
>>> }
>>>
>>> It is up to the user to ensure that the arguments to "min" are all ints,
>>> and none of them match the sentinel value.
>>
> Sorry, I was not thinking things through. Please forget that post.

What post?  :-)
Re: variadic min and max, (any some and none, cat and more)
#734
Author: bartc
Date: Sat, 24 Oct 2026 11:04
44 lines
2846 bytes
On 24/10/2026 11:37, chine.bleu wrote:
> bartc wrote:
>> For this purpose, where all elements are expected to be the same type,
>> then passing a list is more appropriate, and more type-safe. Especially
>> when 'min_func' has a specific return type anyway.
> 
> In general the function argument types might not be known.

So you're talking about variadic functions as they are now? My comment 
was about a different kind of variadic function with variable-length 
argument lists but of a common type, known at compile-time.

> An actual 
> argument list might have 1 byte argument, a 17 byte argument, a 4 byte 
> argument, 128 byte argument.

Still talking about variadic functions? Then in C it's more restricted: 
variadic arguments will be, or be promoted to, one of:

* Integer (typically one of i32 u32 i64 u64)

* Float (typically f64)

* Pointer

* Struct

The last is more variable, but on modern ABIs, a struct that isn't one 
of certain set of patterns will be passed by pointer. (I don't know how 
_BitInt are handled.)


> In languages and environments where the 
> type of each argument is declared, calls can pass arguments with 
> specialised protocols.

So now this is about regular functions? Then there isn't an issue; just 
follow the ABI if functions may be shared across FFIs or separately 
compiled C code.

But for static functions, a compiler can use any scheme it likes. Or in 
some cases, use no scheme at all because it inlines calls.

Re: variadic min and max, (any some and none, cat and more)
#738
Author: fir
Date: Sat, 24 Oct 2026 13:12
29 lines
2153 bytes
chine.bleu pisze:
> fir wrote:
>> problem is imo this leading argument n, imo it should
>>
>> just be called
>>
>> min(34,34,2);
>>
>> thus the variadic support probably need to change
> 
> 
> The compiler cannot be certain which function calls are variadic. Old 
> style function declarations are allowed which provide no information 
> about arguments. You cannot change this without breaking unknown amount 
> of dusty old code.
> 



im not sure as what you say...cant it just set this register to hold the 
info of sze of arguments in case he dont know?

mostly if definition is described as variadic its vaiadic


overally im not sue if i should even consider all that conventions who 
pass args by stack as a list as it seems for me kinda obsolete (but 
maybe i should)
Re: variadic min and max, (any some and none, cat and more)
#739
Author: fir
Date: Sat, 24 Oct 2026 13:23
48 lines
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
Re: variadic min and max, (any some and none, cat and more)
#740
Author: Tim Rentsch
Date: Sat, 24 Oct 2026 14:17
36 lines
2679 bytes
bartc <bc@freeuk.com> writes:

[discussing how to implement min() and max() functions]

> [...]
> I never did an implementation, but the elements would be assembled
> into a buffer, not pushed, and a pointer to that buffer passed as
> well as the length.  (My scheme would have been syntactic sugar
> for slices, which carry a length.)
>
> Of course this is only where all variadic elements are the same
> type.  Mixed types would need to use the existing less safe
> variadic scheme.

First let's take a stab at stating the problem:

 1. Define min() and max() variadic functions or macros ...

 2. That accept any (reasonable) number of arguments ...

 3. Which can be any combination of suitable types ...

 4. Including standard integer types and real floating types ...

 5. Evaluating each argument exactly once ...

 6. Producing a result having a type suitable to the arguments ...

 7. And does something sensible when arguments are of mixed types.

Sadly the discussion that followed consisted mostly of partial
ideas for how some simpler problem might be solved.  Instead just
implement something (in standard C, since this is comp.lang.c);
it can be done in C11.  Then either post a solution or explain a
problem encountered during an attempted solution.  Most of the
comments that have been posted were just ego stroking.
Re: variadic min and max, (any some and none, cat and more)
#741
Author: bartc
Date: Sat, 24 Oct 2026 15:05
56 lines
3465 bytes
On 24/10/2026 15:17, Tim Rentsch wrote:
> bartc <bc@freeuk.com> writes:
> 
> [discussing how to implement min() and max() functions]
> 
>> [...]
>> I never did an implementation, but the elements would be assembled
>> into a buffer, not pushed, and a pointer to that buffer passed as
>> well as the length.  (My scheme would have been syntactic sugar
>> for slices, which carry a length.)
>>
>> Of course this is only where all variadic elements are the same
>> type.  Mixed types would need to use the existing less safe
>> variadic scheme.
> 
> First let's take a stab at stating the problem:
> 
>   1. Define min() and max() variadic functions or macros ...
> 
>   2. That accept any (reasonable) number of arguments ...
> 
>   3. Which can be any combination of suitable types ...
> 
>   4. Including standard integer types and real floating types ...
> 
>   5. Evaluating each argument exactly once ...
> 
>   6. Producing a result having a type suitable to the arguments ...
> 
>   7. And does something sensible when arguments are of mixed types.

I thought (3) implied mixed types, so that it would work even in that 
case. (Maybe 'suitable' needs to be defined.)

But (7) suggests that would be an error. What about types such as 
pointers (where comparisons can work), or structs (where they don't)?

Without a more vigorous spec, this is just too open-ended.

> 
> Sadly the discussion that followed consisted mostly of partial
> ideas for how some simpler problem might be solved.

And what /was/ the problem? The one I concentrated on was a different 
way of dealing with a variable number of arguments to a function, via a 
hypothetical new feature. Not specifically multi-operand min/max.

I did not look at how it would be done in standard C (I only suggested 
how a likely mechanism might be expressed in standard C, for the purpose 
of calling from a regular compiler, but one which would be too unwieldy 
to use in practice.)

> Most of the
> comments that have been posted were just ego stroking.

Yours won't be of course!
Re: variadic min and max, (any some and none, cat and more)
#742
Author: fir
Date: Sat, 24 Oct 2026 16:37
114 lines
4875 bytes
fir pisze:
> 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
> 

those some any and none could also be implemented

like

int some (int a, ...)
{
   for(int i=0; i<N; i++)
   {	
	if(arg[i]) return 1;

    }
   return 0;

}

its good and logical..clasic c version (from ai)

ai says that you need to pass the N number explicitely and that sucks
i also dont know as to efficiency

#include <stdarg.h>

int some(int N,...)
{
     int i;
     int a;
     va_list arg;

     va_start(arg,N);

     for(i=0;i<N;i++)
     {
         a=va_arg(arg,int);
         if(a)
         {
             va_end(arg);
             return 1;
         }
     }

     va_end(arg);
     return 0;
}


this efficienct of callsic varargs its said depends on architecture and 
im not sure if i want to go into that (But if some has nothing to do may 
found how it is and post on it ..i could see)


overally efficiency of thsi shouldnt be bad.. takin away the question 
floding things on stack is overally slow, but if som e care it may 
inline it and in this case probably this can be optimised

ant to get back to begining of this topic imo such one type varargs
could be quite usefull imo

thou its own form suggast thet the best implementation is


some(int* s)

it would allow pasing some(a,b,c,d,e) and some(tab) or maybe even 
some(int3) (where int3 is a structure of 3 ints and using one code to it all
Re: variadic min and max, (any some and none, cat and more)
#744
Author: Lawrence D’Oliveiro
Date: Sat, 24 Oct 2026 22:24
11 lines
1777 bytes
On Sat, 24 Oct 2026 03:25:02 -0700, chine.bleu wrote:

> The compiler cannot be certain which function calls are variadic.
> Old style function declarations are allowed which provide no
> information about arguments.

*None* of the styles of function declarations that C currently
supports provide any kind of runtime information about arguments. The
whole stdarg(3) mechanism relies on calling and called code agreeing
on their own convention for how to indicate the end of the argument
list, and what types of arguments to expect.
Re: variadic min and max, (any some and none, cat and more)
#747
Author: Keith Thompson
Date: Sat, 24 Oct 2026 23:24
26 lines
2431 bytes
"chine.bleu" <chine.bleu@yahoo.com> writes:
[...]
> The compiler cannot be certain which function calls are variadic. Old
> style function declarations are allowed which provide no information
> about arguments. You cannot change this without breaking unknown
> amount of dusty old code.

Yes, it can.

In C90, if you call a variadic function, the prototype with `, ...`
must be visible at the point of the call.  If the visible declaration
is a non-variadic prototype, or not a prototype, or nonexistent,
the compiler treats it as a non-variadic call.  If the call and
declaration are inconsistent with the actual definition, the
behavior is undefined.

In C99, calls with no visible declaration were made constraint
violations.

In C23, old-style function declarations were removed.  A visible
prototype is always required, and a prototype always indicates
whether the function is variadic or not.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Re: variadic min and max, (any some and none, cat and more)
#748
Author: Keith Thompson
Date: Sat, 24 Oct 2026 23:34
32 lines
2470 bytes
bartc <bc@freeuk.com> writes:
[...]
> Still talking about variadic functions? Then in C it's more
> restricted: variadic arguments will be, or be promoted to, one of:
>
> * Integer (typically one of i32 u32 i64 u64)
>
> * Float (typically f64)
>
> * Pointer
>
> * Struct
>
> The last is more variable, but on modern ABIs, a struct that isn't one
> of certain set of patterns will be passed by pointer. (I don't know
> how _BitInt are handled.)
[...]

That's an odd and incomplete way to state the rules (and you
missed unions).  See "default argument promotions" in the standard.

A variadic argument of an integer type narrower than int is promoted
to int or unsigned int (int if int holds all possible values of the
source type, otherwise unsigned int).  These "integer promotions"
do not apply to _BitInt types.  A variadic argument of type float is
promoted to double.  All other argument types are not promoted --
though the usual array-to-pointer and function-to-pointer conversions
are applied.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Re: variadic min and max, (any some and none, cat and more)
#750
Author: bartc
Date: Sun, 25 Oct 2026 01:40
37 lines
2718 bytes
On 25/10/2026 00:34, Keith Thompson wrote:
> bartc <bc@freeuk.com> writes:
> [...]
>> Still talking about variadic functions? Then in C it's more
>> restricted: variadic arguments will be, or be promoted to, one of:
>>
>> * Integer (typically one of i32 u32 i64 u64)
>>
>> * Float (typically f64)
>>
>> * Pointer
>>
>> * Struct
>>
>> The last is more variable, but on modern ABIs, a struct that isn't one
>> of certain set of patterns will be passed by pointer. (I don't know
>> how _BitInt are handled.)
> [...]
> 
> That's an odd and incomplete way to state the rules (and you
> missed unions).

They will be grouped with structs.


> A variadic argument of an integer type narrower than int is promoted
> to int or unsigned int (int if int holds all possible values of the
> source type, otherwise unsigned int).  These "integer promotions"
> do not apply to _BitInt types.  A variadic argument of type float is
> promoted to double.  All other argument types are not promoted --
> though the usual array-to-pointer and function-to-pointer conversions
> are applied.

The list represented variadic argument types after promotions. It was 
anywhere summarising existing variadic functions as it wasn't clear to 
which kinds Mr .bleu was referring to.
Re: variadic min and max, (any some and none, cat and more)
#751
Author: Keith Thompson
Date: Sun, 25 Oct 2026 02:24
49 lines
3171 bytes
bartc <bc@freeuk.com> writes:
> On 25/10/2026 00:34, Keith Thompson wrote:
>> bartc <bc@freeuk.com> writes:
>> [...]
>>> Still talking about variadic functions? Then in C it's more
>>> restricted: variadic arguments will be, or be promoted to, one of:
>>>
>>> * Integer (typically one of i32 u32 i64 u64)
>>>
>>> * Float (typically f64)
>>>
>>> * Pointer
>>>
>>> * Struct
>>>
>>> The last is more variable, but on modern ABIs, a struct that isn't one
>>> of certain set of patterns will be passed by pointer. (I don't know
>>> how _BitInt are handled.)
>> [...]
>> That's an odd and incomplete way to state the rules (and you
>> missed unions).
>
> They will be grouped with structs.

Will they be?  By whom?  I don't know what that even means.

Perhaps you just forgot about unions -- which would be perfectly
understandable.

>> A variadic argument of an integer type narrower than int is promoted
>> to int or unsigned int (int if int holds all possible values of the
>> source type, otherwise unsigned int).  These "integer promotions"
>> do not apply to _BitInt types.  A variadic argument of type float is
>> promoted to double.  All other argument types are not promoted --
>> though the usual array-to-pointer and function-to-pointer conversions
>> are applied.
>
> The list represented variadic argument types after promotions. It was
> anywhere summarising existing variadic functions as it wasn't clear to
> which kinds Mr .bleu was referring to.

I'm not at all sure what you mean.

You posted an incomplete summary of the promotion rules.  I posted an
accurate summary of the promotion rules.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Re: variadic min and max, (any some and none, cat and more)
#753
Author: Richard Harnden
Date: Sun, 25 Oct 2026 04:24
31 lines
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}));



Re: variadic min and max, (any some and none, cat and more)
#755
Author: Richard Harnden
Date: Sun, 25 Oct 2026 10:55
62 lines
2496 bytes
On 25/10/2026 04:24, Richard Harnden wrote:
> 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}));
> 
> 

That has undefined behaviour - unfortunately, the kind that does what I 
expected :(

You either need to pass the size ...

int min(const int *n, size_t z)
{
     int m = INT_MAX;

     for (size_t i=0; i<z; i++)
         if ( n[i] < m ) m = n[i];

     return m;
}

Or have a NULL terminated pointer to pointer to int ...

int min(int **n)
{
     int m = INT_MAX;

     while ( *n )
     {
         if ( **n < m ) m = **n;

         n++;
     }

     return m;
}
Re: variadic min and max, (any some and none, cat and more)
#756
Author: fir
Date: Sun, 25 Oct 2026 10:59
52 lines
2340 bytes
Richard 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 to
conclude 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





Re: variadic min and max, (any some and none, cat and more)
#757
Author: bartc
Date: Sun, 25 Oct 2026 11:00
42 lines
2638 bytes
On 25/10/2026 02:24, Keith Thompson wrote:
> bartc <bc@freeuk.com> writes:
>> On 25/10/2026 00:34, Keith Thompson wrote:
>>> bartc <bc@freeuk.com> writes:
>>> [...]
>>>> Still talking about variadic functions? Then in C it's more
>>>> restricted: variadic arguments will be, or be promoted to, one of:
>>>>
>>>> * Integer (typically one of i32 u32 i64 u64)
>>>>
>>>> * Float (typically f64)
>>>>
>>>> * Pointer
>>>>
>>>> * Struct
>>>>
>>>> The last is more variable, but on modern ABIs, a struct that isn't one
>>>> of certain set of patterns will be passed by pointer. (I don't know
>>>> how _BitInt are handled.)
>>> [...]
>>> That's an odd and incomplete way to state the rules (and you
>>> missed unions).
>>
>> They will be grouped with structs.
> 
> Will they be?  By whom?  I don't know what that even means.
> 
> Perhaps you just forgot about unions -- which would be perfectly
> understandable.

I just don't consider unions as a special type at all. I mean, what is 
the practical between:

   union {...};

and:

   struct {union {...};};

where "..." is the same in each case?

Re: variadic min and max, (any some and none, cat and more)
#758
Author: 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
Re: variadic min and max, (any some and none, cat and more)
#759
Author: bartc
Date: Sun, 25 Oct 2026 12:06
65 lines
2741 bytes
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);

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!

Re: variadic min and max, (any some and none, cat and more)
#760
Author: fir
Date: Sun, 25 Oct 2026 12:57
87 lines
3492 bytes
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!
> 
> 
Re: variadic min and max, (any some and none, cat and more)
#761
Author: Tim Rentsch
Date: Sun, 25 Oct 2026 15:15
69 lines
2853 bytes
Richard Harnden <richard.nospam@gmail.invalid> writes:

> On 25/10/2026 04:24, Richard Harnden wrote:
>
>> 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}));
>
> That has undefined behaviour - unfortunately, the kind that does what
> I expected :(
>
> You either need to pass the size ...
>
> int min(const int *n, size_t z)
> {
>     int m = INT_MAX;
>
>     for (size_t i=0; i<z; i++)
>         if ( n[i] < m ) m = n[i];
>
>     return m;
> }

If we are willing to treat all arguments as signed integers,
then it's fairly easy to give a solution:


   #include <stddef.h>
   #include <stdint.h>

   #define min(...) (                                                      \
     (min)( HOW_MANY( __VA_ARGS__ ), (intmax_t[]){ __VA_ARGS__ } )         \
   )

   #define HOW_MANY(...) (sizeof ((_Bool[]){ __VA_ARGS__ }) / sizeof (_Bool))

   intmax_t
   (min)( size_t n, intmax_t v[n] ){
     intmax_t r = INTMAX_MAX;
       for(  size_t k = 0;  k < n;  k++  ){
           r = v[k] < r ? v[k] : r;
       }
       return  r;
   }
Re: variadic min and max, (any some and none, cat and more)
#762
Author: fir
Date: Sun, 25 Oct 2026 18:04
96 lines
3934 bytes
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

though modern are maybe 2-3 times faster at most i guess
Re: variadic min and max, (any some and none, cat and more)
#764
Author: Chris M. Thomasson
Date: Sun, 25 Oct 2026 20:49
101 lines
4115 bytes
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.

> 
> though modern are maybe 2-3 times faster at most i guess
Re: variadic min and max, (any some and none, cat and more)
#768
Author: Chris M. Thomasson
Date: Sun, 25 Oct 2026 21:44
104 lines
4396 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
>>
>> 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
> 

If you want some free models to work with. check out SketchFab.
Re: variadic min and max, (any some and none, cat and more)
#769
Author: Lawrence D’Oliveiro
Date: Sun, 25 Oct 2026 21:56
5 lines
1608 bytes
On Sun, 25 Oct 2026 14:44:15 -0700, Chris M. Thomasson wrote:

> If you want some free models to work with. check out SketchFab.

Aren’t they more oriented towards 3D printing?
Re: variadic min and max, (any some and none, cat and more)
#770
Author: Keith Thompson
Date: Sun, 25 Oct 2026 22:43
11 lines
1725 bytes
bartc <bc@freeuk.com> writes:
[...]
> I just don't consider unions as a special type at all.

Well, you're wrong.

[...]

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Re: variadic min and max, (any some and none, cat and more)
#771
Author: Chris M. Thomasson
Date: Sun, 25 Oct 2026 22:58
9 lines
1872 bytes
On 10/25/2026 2:56 PM, Lawrence D’Oliveiro wrote:
> On Sun, 25 Oct 2026 14:44:15 -0700, Chris M. Thomasson wrote:
> 
>> If you want some free models to work with. check out SketchFab.
> 
> Aren’t they more oriented towards 3D printing?

Well, fir should know how to load a 3d model and light it. The AI can do 
it for him?
Re: variadic min and max, (any some and none, cat and more)
#772
Author: Chris M. Thomasson
Date: Sun, 25 Oct 2026 22:59
108 lines
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
> 
Re: variadic min and max, (any some and none, cat and more)
#773
Author: fir
Date: Mon, 26 Oct 2026 00:32
133 lines
5501 bytes
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
> 
Re: variadic min and max, (any some and none, cat and more)
#774
Author: fir
Date: Mon, 26 Oct 2026 00:45
152 lines
6412 bytes
fir pisze:
> 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
> 

also maybe kinda interesting conclusion as to code:

i tried in fact 3 versions of this rasterizer : fixed points, ints 
(mixed with floats), and floats..and what showed best?

meybe on older cpus fixedpoints or ints were notably faster but even on 
my old i3 cpu it showed float rasterizer is not notably slower and is
better (long ver y thin triangles flick, and on floats not - so 
surprisingly float version showet the best
(but on older cpu, even like core 2 i got some yeras ago probaby the 
mixed int+floats was faster enough to be worth it...


it seems not now though i was not doing many tests - and posssibly its 
good becouse on floats its quite easier to write things
> 
> 
>>>
>>> though modern are maybe 2-3 times faster at most i guess
>>
> 
Re: variadic min and max, (any some and none, cat and more)
#775
Author: Lawrence D’Oliveiro
Date: Mon, 26 Oct 2026 00:52
15 lines
1992 bytes
On Sun, 25 Oct 2026 15:58:58 -0700, Chris M. Thomasson wrote:

> On 10/25/2026 2:56 PM, Lawrence D’Oliveiro wrote:
>>
>> On Sun, 25 Oct 2026 14:44:15 -0700, Chris M. Thomasson wrote:
>> 
>>> If you want some free models to work with. check out SketchFab.
>> 
>> Aren’t they more oriented towards 3D printing?
> 
> Well, fir should know how to load a 3d model and light it.

There are better sources of models for on-screen work.

Sci-fi fan? How about this <https://trekmeshes.eu/>.
Re: variadic min and max, (any some and none, cat and more)
#776
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 02:31
138 lines
5847 bytes
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.
Re: variadic min and max, (any some and none, cat and more)
#777
Author: fir
Date: Mon, 26 Oct 2026 11:27
168 lines
7278 bytes
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
Page 1 of 2 • 101 total messages
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads