[ub] ub due to left operand of shift

Lawrence Crowl Lawrence at Crowl.org
Thu Oct 31 06:22:29 CET 2013


On 10/30/13, John Regehr <regehr at cs.utah.edu> wrote:
>> void print_type( int arg )
>>    { std::cout << "unsigned" << std::endl; }
>> void print_type( unsigned int arg )
>>    { std::cout << "signed" << std::endl; }
>
> Wait a sec, each of these is printing the opposite of what it's supposed
> to print, right?

Oh, sorry, transcription error.  At any event, in in my mind, the unexpected
thing happens.  (Unexpected from the user view, not from the standards view.)

-- 
Lawrence Crowl


More information about the ub mailing list