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,293 of 243,242   
   David Brown to bart   
   Re: _BitInt(N)   
   01 Dec 25 16:28:08   
   
   From: david.brown@hesbynett.no   
      
   On 01/12/2025 15:14, bart wrote:   
   > On 01/12/2025 13:37, David Brown wrote:   
   >   
   >> I'd be happy if C did not have integer promotions.   
   >   
   > Well, now it doesn't with _BitInt types. So this stores 0 in 'a', not 256:   
   >   
   >      int a;   
   >      unsigned _BitInt(8) b = 255, c = 1;   
   >      a = b + c;   
   >   
   >   
      
   Correct.   
      
   There were a number of potential use-cases for _BitInt types that worked   
   better without integer promotions, and it's easy enough to ask for the   
   equivalent of integer promotions if you need them (by converting to   
   int), so _BitInt types are exempt from integer promotions.   
      
   Yes, I am glad there is now this choice in C.   
      
   --- 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