From: bc@freeuk.com   
      
   On 08/02/2026 08:52, Michael S wrote:   
   > On Fri, 6 Feb 2026 13:04:34 +0000   
   > Bart wrote:   
   >   
      
   >>> Vararg via FFI? Is it really a good idea?   
   >>>   
   >>   
   >> It's covered by platform ABIs of both Windows and SYS V.   
   >>   
   >   
   > My question was not about technical possibility. I understand that with   
   > enough of effort everything is possible.   
   > I asked whether it is a good idea.   
   > Is not it simpler for you and for your potential users to declare that   
   > your language can not call external C functions with variable number of   
   > arguments? To me it does not sound like this ability is either necessary   
   > or very valuable.   
   >   
   > Above I assume that we are talking about your scripting language.   
   >   
   > W.r.t. your other language, I have no strong opinion. But my weak   
   > opinion is that it also does not need it, possibly with exception for   
   > ability to do few (very few, hopefully) historically idiotically   
   > defined Unix system calls that can be handled individually as special   
   > cases.   
      
      
   It's needed if any program in either of my languages needs to call an   
   FFI function in a library that happens to use variadic arguments.   
      
   I already know that at least one language needs to call *printf with at   
   least two arguments.   
      
   But it can come up elsewhere. Looking around:   
      
    extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const   
   char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);   
    SQLITE_API int sqlite3_config(int, ...); // many like this   
    SQLITE_PRIVATE void sqlite3VdbeMultiLoad(Vdbe*,int,const char*,...);   
    LUA_API int (lua_gc) (lua_State *L, int what, ...);   
    int *elem(array a, ...){   
    static void error(const char *msg, ...)   
    int open(const char* filename, int flags, ...)   
    int wsprintfW(LPWSTR,LPCWSTR,...);   
      
   Mostly likely variadic functions were only created in order to implement   
   'print', but nothing stops people using them for other purposes.   
      
   So the likelihood is there for them to occur in APIs.   
      
   In my case, most support I have to do is within my backend, and the same   
   backend is needed for my C compiler. So it is needed anyway.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|