News for hackers. Stuff that matters.
Re:If-else vs switch – Which is better? by wizardofoz on Sunday August 02, 2009 @10:28PM (#738473)
Code that test the finite switch:

3. for (int i = 0; i < iteration; i++) {

4. testSwitchFinite(i);

5. }

Once i > 5, testSwitchFinite will always skip to default. This function doesn't even test the switch properly.

Something like testSwitchFinite(i%5+1) would have made more sense (for the finite switch and if-else.)

There are no comments on this comment yet.