Date: 2003-02-08 08:02 am (UTC)
Microsoft, everyone's favorite Java experts, had this (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vjref98/html/14_19.asp) to say about it. According to them, Java basically forbids unreachable statements, but makes an exception for if blocks so that you can do conditional compilation.

I don't know if I think that's a good thing or a bad thing. I suppose it's good that I can't accidentally chop out half a method by putting in a poorly placed return statement. On the other hand, I only run into this situation when I'm deliberately attempting to chop out half a method.

The unreachable statement thingy also drives me nuts in switch statements because as a C programmer I learned that you always put "break" at the end of a case, but in Java you can't use "break" if you're returning from that case (which makes the break unreachable). It just looks wrong to have a switch statement with no breaks, even if I know it's not going to fall through.
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

blinker: (Default)
blinker

April 2009

S M T W T F S
   1234
567891011
12131415161718
19202122232425
26 27282930  

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 27th, 2025 12:35 am
Powered by Dreamwidth Studios