Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×

Comment Re:Wou would have thought. (Score 1) 50

But how exactly does a planet "snatch" another object? The smaller object starts out at a huge distance from the planet, falls towards it (increasing its kinetic energy), passes by the planet (if it doesn't crash into it), and then... converts its kinetic energy back to the amount of potential energy it started out with, right?

Now if two different bodies would collide while close to the planet, some of the debris might just end up in orbit around the planet. But why would one small object not simply leave the planet again?

(Just an honest question, not saying anyone is wrong, just wondering how it works)

Comment Re:Thanks to reader sleepypsycho for the poll idea (Score 2) 169

You can disable the Karma bonus. The problem with the bonus is that it adds one to the displayed score, but is not counted for achievements. Once you have a score:5 (which is really score 4 + 1 bonus), people stop modding you up so you never make it to a "real" +5. They can still mod you up one more point, but most people don't know so they don't. And this makes you miss achievements that require a "real" +5 (comedian, for example)

caveat: maybe they have changed the system in the mean time, but I remember it certainly used to work that way.

Comment Re:The ultimate ugly hack? (Score 1) 264

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.

Comment Re:The ultimate ugly hack? (Score 1) 264

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...

Comment Re:Such is C (Score 2) 264

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);
        }
}

Comment Re:Such is C (Score 1, Insightful) 264

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)

Slashdot Top Deals

The one day you'd sell your soul for something, souls are a glut.

Working...