From: jameskuyper@alumni.caltech.edu   
      
   On 2026-01-07 08:06, Tim Rentsch wrote:   
   > scott@slp53.sl.home (Scott Lurndal) writes:   
   >   
   >> Michael S writes:   
   >>   
   >>> On Tue, 6 Jan 2026 10:31:41 -0500   
   >>> James Kuyper wrote:   
   >>>   
   >>>> If you know that an expression has one of the standard-named types or   
   >>>> typedefs for with there is a corresponding printf() specifier, you   
   >>>> should use that specifier. Otherwise, if you know that an expression   
   >>>> has one of the types declared in , you should use the   
   >>>> corresponding macro #defined in to print it.   
   >>>   
   >>> I should? Really?   
   >>> Sorry, James, but you have no authority to make such statements.   
   >>   
   >> James is paraphrasing the C standard.   
   >   
   > Really? What passage in the C standard is being paraphrased?   
      
   This is advice, not paraphrased text from the C standard. It's based   
   upon several facts that are mentioned in the text of the standard:   
      
   1. has typedefs for a variety integer types. They are   
   typedefs precisely because they can, in general, specify different types   
   on different implementations of C.   
      
   2. contains macros for printf and scanf type specifiers   
   appropriate for use with those typedefs.   
      
   3. Using an inappropriate type specifier in either the printf() or   
   scanf() families has undefined behavior, something that I generally want   
   to avoid.   
      
   For me, throughout most of my career, a high degree of portability was   
   always required of my delivered code. Therefore, the desirability of   
   using the type specifier macros, despite their clumsiness,   
   follows from those facts. For other people, who don't mind restricting   
   the portability of their code to platforms where it doesn't make a   
   difference, the simplicity of using a fixed type specifier is more   
   important.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|