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 242,790 of 243,242   
   Kenny McCormack to bc@freeuk.com   
   Re: printf and time_t   
   05 Jan 26 13:52:20   
   
   From: gazelle@shell.xmission.com   
      
   In article <10jgdu9$2t8dh$1@nntp.eternal-september.org>,   
   bart   wrote:   
   >On 05/01/2026 12:45, Kenny McCormack wrote:   
   >> In article <20260105105138.00005f0a@yahoo.com>,   
   >> Michael S   wrote:   
   >> ...   
   >>> I can't think about situation in which casting time_t value to 'long   
   >>> long' can go wrong.   
   >>   
   >> These are all good suggestions, but in the end, are all just kludgey   
   >> workarounds.  My two points in posting are:   
   >>   
   >>      1) There really should be a generic way to print any numeric object and   
   >>      have the compiler "Do The Right Thing".   
   >   
   >My original C compiler had a way to do it:   
   >   
   >   #include    
   >   #include    
   >   
   >   int main(void) {   
   >      printf("%v\n", clock());   
   >   }   
   >   
   >The special format "%v" (obviously only possible within a string   
   >literal) is translated by the compiler into a suitable default for the   
   >type of the corresponding expression.   
      
   Good thing.  I had been about to say, in some post on this thread, that   
   lots of other languages can do this (starting with, e.g., BASIC), so why   
   can't C do it?   
      
   And, although I can't quite recall at the moment which language it was, I   
   know there was some language where it would do the label thing, too.  I.e.,   
   you would code "print foo" and it would print "foo=...".   
      
   --   
   "Unattended children will be given an espresso and a free kitten."   
      
   --- 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