home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 243,172 of 243,242   
   Bart to Keith Thompson   
   Re: printf and time_t   
   06 Feb 26 13:05:48   
   
   From: bc@freeuk.com   
      
   On 06/02/2026 12:49, Keith Thompson wrote:   
   > Tim Rentsch  writes:   
   >> Keith Thompson  writes:   
   > [...]   
   >>> I recently played around with an attempted framework using _Generic.   
   >>> The goal was to be able to write something like   
   >>>   
   >>>      print(s(x), s(y), s(z));   
   >>>   
   >>> where x, y, and z can be of more or less arbitrary types (integer,   
   >>> floating-point char*).  The problem I ran into was that only one of   
   >>> the generic associations is evaluated (which one is determined at   
   >>> compile time), but *all* of them have to be valid code.   
   >>   
   >> That is annoying but it shouldn't be too hard to work around   
   >> it.  To verify that hypothesis I wrote this test case:   
   >>   
   >>   
   >>          #include    
   >>          #include    
   >>          #include    
   >>   
   >>          #include "h/show.h"   
   >>   
   >>          int   
   >>          main(){   
   > [30 lines deleted]   
   >>              show(   
   >>                  uc,sc,us,ss,ui,si,ul,sl,ull,sll,   
   >>                  c,f,d,ld,yes,no,u16,s16,uge32,sge32,   
   >>                  runtime,now,offset,uf32,sf32,   
   >>                  c * now / 1e8 * ld,   
   >>                  foo, bas   
   >>              );   
   >>              printf( "\n" );   
   >>   
   >>              return  0;   
   >>          }   
   >>   
   >> which compiles under C11 and (along with the show.h include file)   
   >> produces output:   
   >>   
   >>                    uc = 255   
   >>                    sc = -1   
   >>                    us = 65535   
   > [23 lines deleted]   
   >>                   foo = "foo"   
   >>                   bas = (const char *) "bas"   
   >   
   > Were you planning to show us what show.h looks like?   
      
   Of course not!   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca