Removing undefined behavior of bitshifts

Vladimir Panteleev vladimir at thecybershadow.net
Mon Jun 6 20:25:18 PDT 2011


On Tue, 07 Jun 2011 02:20:17 +0300, Timon Gehr <timon.gehr at gmx.ch> wrote:

> I'd much prefer the behavior to be defined as 1<<x; being equivalent to
> 1<<(0x1f&x); (That's what D effectively does during runtime. It is also  
> what the machine code supports, at least in x87).

Can you think of any cases where this overflow behavior would be expected  
and useful? D can't (cheaply) catch runtime instance of this, but at  
compile-time it should definitely be an error.

-- 
Best regards,
  Vladimir                            mailto:vladimir at thecybershadow.net


More information about the Digitalmars-d mailing list