From: already5chosen@yahoo.com   
      
   On Thu, 8 Jan 2026 19:31:13 -0500   
   "James Russell Kuyper Jr." wrote:   
      
   > On 2026-01-07 19:38, Michael S wrote:   
   > > On Wed, 07 Jan 2026 16:00:19 -0800   
   > > Keith Thompson wrote:   
   > ...   
   > >> So you'd write code that happens to work on some implementations   
   > >> rather than code that's correct on all implementations.   
   > >>   
   > >   
   > > No, it is correct on all implementation. Idea that in C, as opposed   
   > > to C++, two unsigned integer types of the same size are somehow   
   > > different is, IMHO, an abomination. And that is one not especially   
   > > common case in which I don't care about opinion of the Standard.   
   >   
   > We're not talking about two unsigned integer types with same size.   
   > We're talking about unsigned long, which can be any size >= 32 bits,   
   > and uint32_t, which can only be exactly 32 bits. Your code is NOT   
   > portable to a platform where unsigned long is greater than 32 bits.   
   >   
      
   I don't know how you came to discussions of what is possible.   
   My statement was concrete. It was about platforms like Windows (of all   
   flavors) and 2-3 specific 32-bit embedded targets that I currently   
   care about.   
   On all these platforms uint32_t is alias of 'unsigned long' which is   
   32-bit wide. 'unsigned int' is also 32-bit wide.   
   I claim that *on these platforms* uint32_t and 'unsigned int' are *not*   
   different types. I don't care to what the Standard says about it.   
   I do care about what gcc says about it because I am annoyed by warnings   
   that I consider pointless.   
      
   Printing uint32_t values on these platforms with %u specifier, apart   
   from advantage of being shorter, has advantage of being undoubtedly   
   correct on LIN64. Unlike printing with %lu.   
      
   Now, going one step further and using more intimate knowledge of SysV   
   ABI I can argue with myself and prove (could I? I am only 95% sure)   
   that on LIN64 %lu will also always print correct result. But I don't   
   want to take this step.   
      
   > ...   
   > > I also don't care. Since for more than decade* I didn't have target   
   > > with 'int' shorter than 32 bits, I just use %u. It takes me zero   
   > > thinking.   
   >   
   > As a general rule, I find that people who claim a decision requires   
   > no thought generally are referring to a decision that should have   
   > been made differently if sufficient thought had been put into it.   
   > This is a prime example.   
   >   
   > > BTW, I am always aware of exact sizes of the basic types of the   
   > > target that I work on. I don't feel comfotable without such   
   > > knowledge. That how my mind works. It has problems with too   
   > > abstract abstractions.   
   >   
   > I'd have no problem with your approach if you hadn't falsely claimed   
   > that "It is correct on all platforms".   
      
   Which I didn't.   
      
   > There's nothing wrong with   
   > code that is intentionally platform specific. Platform-specific code   
   > that the author incorrectly believes to be "correct on all platforms"   
   > is a problem.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|