Everybody wants cheaper stuff. Are you ashamed of yourself when buying a cheaper consumer article ?
Were slaveowners ashamed of themselves for getting free labor? Probably not, but being "ashamed of yourself" isn't really a relevant question to pose to people who are proud of what they did.
The Earth is not flat therefore Kansas is not flat.
A sphere can still have a flat spot, can't it? Slice a sphere with a plane just inside its radius, and the intersection will be perfectly flat. I don't know much about Kansas, but your logic certainly seems flawed.
I wasn't talking about Duff's device anymore, just the general normal usage of switch statements and the fact that they fall through by default, instead of the more logical opposite choice of breaking by default and continuing only by choice with an explicit instruction. Someone replied that falling through was useful if a whole list of values needed the same treatment, but I think it would have been better to have a standard where a list of values (and possibly ranges) could be provided rather than a silly list of "case x:case y:case z:".
Obviously, if you wanted to use Duff's device with such a modified switch syntax, every case label would need a "continue" to fall through explicitly.
OK, I'll amend my position slightly: they should break by default (and continue as an explicit option) but you should obviously be able to provide a list of values instead of the ridiculous 50 consecutive "case 5:case 6: case 7:...". Better still, they might add ranges while they're at it.
Oh well, I don't imagine them changing the standard for that any time soon, but one can dream...
Any decent compiler makes those changes automatically. Probably even with optimisations switched off, since these are such a no-brainer.
They really ought to have done it the other way around: break by default, and use "continue" to fall through. It can indeed be useful sometimes, but in the vast majority of cases you want it to break, and forgetting that statement causes all sorts of trouble.
They probably chose "ugly hack" because they couldn't figure out how to write a regexp that matched "hack" but didn't match "whack", "shack" etc.
Next up, a new study detailing how many puppies are killed by different programming languages, based on the comments in the code.
I remember something similar, called Duff's device. Not two overlapping switch statements (I don't think that's possible), but an intertwined loop and switch. I don't see any references to lines in bitmaps, but it's entirely possibe that the same kind of construction was used for that purpose too.
send(to, from, count)
register short *to, *from;
register count;
{
register n = (count + 7) / 8;
switch (count % 8) {
case 0: do { *to = *from++;
case 7: *to = *from++;
case 6: *to = *from++;
case 5: *to = *from++;
case 4: *to = *from++;
case 3: *to = *from++;
case 2: *to = *from++;
case 1: *to = *from++;
} while (--n > 0);
}
}
Ideally, you should include a generic version without any hackish optimizations, but it isn't strictly required if you don't think you'll ever change CPUs in the future.
And then your company upgrades its CPUs while you're long gone, and now they need to figure out who the hell wrote that crappy piece of code that keeps crashing on the new CPU, and some other programmer has to rewrite everything from scratch because they can't figure out how your code works and why it's not doing what it's supposed to be doing.
By the way, that other programmer may just be an older version of you who has completely forgotten what the younger version did there... (not that I have any experience with that, cough)
Tell that to people in the US who had their cash, car or even house seized because it might be connected to a crime. Traveling with $10000 cash? Surely that must be drug money, no matter how plausible your excuse is, we'll take it to buy game consoles, zambonis or margarita machines. You can always try to get it back by hiring a lawyer and going to court, good luck.
Carly spouted off on Saturday about net neutrality, and claimed that it was forced down our throats by lobbyists from Verizon and Comcast.
https://www.youtube.com/watch?...
And she says this as a former CEO of HP. I hope her campaign fails soon because her voice gives me faceslapping injuries.
HELP!!!! I'm being held prisoner in /usr/games/lib!