XPost: alt.folklore.computers   
   From: cr88192@gmail.com   
      
   On 8/6/2025 6:05 AM, Anton Ertl wrote:   
   > BGB writes:   
   >> If 'int' were 64-bits, then what about 16 and/or 32 bit types.   
   >> short short?   
   >> long short?   
   >   
   > Of course int16_t uint16_t int32_t uint32_t   
   >   
      
   Well, assuming a post C99 world.   
      
      
   > On what keywords should these types be based? That's up to the   
   > implementor. In C23 one could   
   >   
   > typedef signed _BitInt(16) int16_t   
   >   
      
   Possible, though one can realize that _BitInt(16) is not equivalent to a   
   normal 16-bit integer.   
      
    _BitInt(16) sa, sb;   
    _BitInt(32) lc;   
    sa=0x5678;   
    sb=0x789A;   
    lc=sa+sb;   
      
   Would give:   
    0xFFFFCF12   
   Rather than 0xCF12 (as would be expected with 'short' or similar).   
      
   Because _BitInt(16) would not auto-promote before the addition, but   
   rather would produce a _BitInt(16) result which is then widened to 32   
   bits via sign extension.   
      
      
   > etc. Around 1990, one would have just followed the example of "long   
   > long" of accumulating several modifiers. I would go for 16-bit   
   > "short" and 32-bit "long short".   
   >   
      
   OK.   
      
   Apparently at least some went for "__int32" instead.   
      
      
   > - anton   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|