home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 31,902 of 33,346   
   Seungbeom Kim to Francis Glassborow   
   Re: "Portability" of operators working o   
   11 Feb 12 15:20:30   
   
   From: musiphil@bawi.org   
      
   On 2012-02-10 14:14, Francis Glassborow wrote:   
   > How an actual system represents values is irrelevant, the C++ Standard   
   > requires that an implementation conforms to the abstract machine. In C++   
   > this abstract machine is required to represent integer types in a pure   
   > binary form (there are three options, two's complement (most common)   
   > ones complement (I think this is very rare these days), sign and   
   > magnitude (again rare). There are no other options. The bitwise   
   > operators will operate on the 'bits' even if the underlying system uses   
   > some other representation.   
      
   Then, is the result of a bitwise operation implementation-defined,   
   depending on the representation of negative numbers?   
   For example, how is the result of (3 & -3) defined -- can it be   
   any of 0, 1, or 3?   
      
   -3 = 11..1101 (2C)   
   -3 = 11..1100 (1C)   
   -3 = 10..0011 (SM)   
      
   --   
   Seungbeom Kim   
      
      
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- 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