Is there ANY chance we can fix the bitwise operator precedence rules?

Don nospam at nospam.com
Tue Jun 22 05:19:59 PDT 2010


Steven Schveighoffer wrote:
> On Mon, 21 Jun 2010 20:40:14 -0400, Adam Ruppe 
> <destructionator at gmail.com> wrote:
> 
>> What's the point of a switch without implicit fallthrough?
> 
> Maintenance.  Using if statements instead of switch, you have to repeat 
> the value to test for each of the cases.  If you want to change the 
> value being tested, it's one change.  And your workaround using a 
> delegate is not very appealing.
> 
> I'll also point out that popular languages have a switch statement and 
> don't allow implicit fallthrough, meaning that 100% of switch statements 
> do not have fallthrough.  And switch is used quite often in those 
> languages too, so at least some people think it has use besides allowing 
> implcit fallthrough.
> 
> I think mostly it's because the meaning of it is so easy to understand 
> when reading/writing it.  When you see a switch, you know what it is and 
> what it isn't.  An if statement has many possibilities and must be read 
> more carefully.
> 
> -Steve

I believe that the switch statement originated as the equivalent of an 
asm jump table. You have a list of values, and a list of addresses to 
jump to. The existence of fallthough seems to be an implementation artifact.


More information about the Digitalmars-d mailing list