this is the correct way of calling k() with variable number of parms:
k(0,“1”,(S)0)
after doing some fossicking around, i believe the (S) is not required.
ie. k(0,“1”,0)
on linux 64, the terminating 0 is promoted to 64bit (SYSV ABI)
on linux 32, to 32bit int
on other 32bit platforms, 0 is promoted to 32bit
on win64, the ABI is similar to linux 64
mac, arm?
On Tuesday, April 17, 2018 at 12:46:56 AM UTC-4, effbiae wrote:
this is the correct way of calling k() with variable number of parms:
k(0,“1”,(S)0)
The idiomatic way is k(0, .., (K)0) which highlights the fact that varargs are K objects. I used this form for years on many different 64- and 32-bit platforms and never had any problems.
> The idiomatic way is k(0, .., (K)0)
yes, i have seen that used commonly.
on kdb platforms, (K)0 or (S)0 or (void*)0 are all “correct” as they are null pointers
it turns out (on linux, and other platforms) that the last 0 in k(0,“1”,0) is identical to the null pointer due to the ABIs of these platforms
so it could be that a variadic k() call is more readable by shaving off the cast.