From: bc@freeuk.com   
      
   On 07/01/2026 11:41, Michael S wrote:   
   > On Wed, 7 Jan 2026 01:14:21 +0000   
   > bart wrote:   
   >   
   >> On 07/01/2026 00:44, James Kuyper wrote:   
   >>> On 2026-01-06 13:05, Michael S wrote:   
   >>   
   >>>> in case of using %u to print 'unsigned long' on target with 32-bit   
   >>>> longs, or like using %llu to print 'unsigned long' on target with   
   >>>> 64-bit longs, then beauty wins. Easily.   
   >>>   
   >>> You've got it backwards. "%u" is the correct specifier to use for   
   >>> unsigned long on all platforms, whether unsigned long is 32, 36, or   
   >>> even 48 bits.   
   >>   
   >> So not "%lu"?   
   >>   
   >>   
   >   
   > gcc and clang maintainers certainly think so.   
   >   
      
   They think it is correct or not correct? If I compile this:   
      
    #include    
      
    int main() {   
    unsigned long a=0;   
    printf("%u", a);   
    }   
      
   then gcc complains (given suitable options):   
      
    warning: format '%u' expects argument of type 'unsigned int', but   
    argument 2 has type 'long unsigned int' [-Wformat=]   
      
   The suggests it is not correct.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|