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,145 of 243,242   
   Michael S to Michael S   
   Re: _BitInt(N)   
   25 Nov 25 23:11:58   
   
   From: already5chosen@yahoo.com   
      
   On Tue, 25 Nov 2025 14:12:07 +0200   
   Michael S  wrote:   
   >   
   > Doing the same with shifts is almost as convenient as with _BitInt and   
   > it works great on all popular compilers, but according to wording of C   
   > Standard it is Undefined Behavior.   
   >   
   > int sign_extend12(unsigned x)   
   > {   
   >   return (int32_t)((uint32_t)x << 20) >> 20;   
   > }   
   >   
      
   Before someone corrects me, I'd correct myself: the code above does not   
   contain Undefined Behavior. It's merely Implementation Defined Behavior.   
      
   --- 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