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

Steven Schveighoffer schveiguy at yahoo.com
Tue Jun 22 04:26:45 PDT 2010


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


More information about the Digitalmars-d mailing list