Signed word lengths and indexes

Don nospam at nospam.com
Thu Jun 17 08:31:47 PDT 2010


BCS wrote:
> Hello Don,
> 
>> Surprise! c == -1.
> 
> No kidding!
> 
>> Because 1 is an int, b gets promoted to int before the shift happens.
> 
> Why would it ever need to be promoted? Unless all (most?) CPUs have only 
> size_t shifts, all three shifts should never promote the LHS.
> 

It shouldn't NEED to. But C defined that >> and << operate that way.


More information about the Digitalmars-d mailing list