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,902 of 243,242   
   Keith Thompson to Michael S   
   Re: printf and time_t   
   07 Jan 26 17:36:34   
   
   From: Keith.S.Thompson+u@gmail.com   
      
   Michael S  writes:   
   > On Wed, 07 Jan 2026 16:00:19 -0800   
   > Keith Thompson  wrote:   
   >> Michael S  writes:   
   >> > On Wed, 07 Jan 2026 13:28:45 -0800   
   [...]   
   >> >> Michael, if you'd care to clarify, given:   
   >> >>   
   >> >>     unsigned long n = 42;   
   >> >>     printf("%u\n", n);  // incorrect   
   >> >>     printf("%lu\n", n); // correct   
   >> >>   
   >> >> (and assuming that unsigned int and unsigned long are the same   
   >> >> width on the current implementation), do you really prefer the   
   >> >> version marked as "incorrect"?   
   >> >   
   >> > I hoped that I already clarified that point more than one time.   
   >> > Obviously, I hoped wrong.   
   >>   
   >> And you still haven't.  I asked a specific question above.  What is   
   >> your answer?  Would you use a "%u" format to print a value that's   
   >> defined with type unsigned long?  I inferred from what you wrote   
   >> that your answer would be yes.  If your answer is no, I'll gladly   
   >> accept that.  (And if so, what you wrote previously was unclear,   
   >> but I'm not going to worry about that if you clarify what you meant)   
   >   
   > When n declared as 'unsigned long' derectly rather than via unint32_t   
   > alias than the answer is 'no'.   
      
   Thank you for answering that.   
      
   >> You've previously indicated that you find "%lu" uglier than "%u",   
   >> and that that's relevant to which one you would use.  Do you still   
   >> think so?   
   >>   
   >> I would appreciate direct yes or no answers to both of those   
   >> questions.   
   >   
   > It depends on how n declared.   
   > When it declared as 'unsigned long' then "lu" is not uglier.   
   > When it is defined as uint32_t it is uglier, despite the fact that on   
   > absolute majority of the targets that I care about the latter is an   
   > alias of the former.   
      
   Let me see if I understand you correctly.   
      
       uint32_t n = 42;   
       printf("%u\n", n);   
       printf("%lu\n", n);   
      
   In this context, you find "%lu" uglier than "%u"?   
      
   [SNIP]   
      
   --   
   Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com   
   void Void(void) { Void(); } /* The recursive call of the void */   
      
   --- 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