Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×

Comment Re:Good grief... (Score 1) 681

Much of the knowledge can be applied to other architectures as well. I recall rewriting some pixel rotation code in order to optimize it for how the cache and memory actually work and saw a huge speed-up, over 400% by making memory accesses mostly linear instead of all over the place and adding some prefetching support. Basic things like that can make an enormous improvement in performance. Most programmers don't think about things like the CPU cache or registers or pipelining or how some operations are a lot more expensive than others (i.e. divide vs multiply).

Comment Re:Lawyers rejoice!! (Score 1) 114

My employer is not a fortune 500 company and we just got a notice from IT that none of the corporate Lenovo laptops are affected and only consumer laptops are affected. This is most likely due to the fact that corporate laptops tend to not have all the usual consumer bloatware installed.

Comment Re:What's Unique To Goto? (Score 1) 677

At the time I don't think it did. Recursion has its place and can be a very elegant solution. Unfortunately most examples I see showing it are better off not using it. In the language we had to use it in it didn't work well, especially since the Pascal P compiler was absolute shit and I proved beyond a shadow of a doubt why it sucks since it ran so slowly with high stack usage compared to a simple loop.

Comment Re:All it will take is (Score 1) 580

I got chicken pox as a teenager and got it bad. I was out for several weeks and still have scars from it. I would gladly have had the vaccine if it had been available. I will also be the first to get a shingles vaccine when I get older.

People died from measles and got permanent brain damage and deafness from it. It's one of the most highly communicable diseases known to man. My grandfather suffered from the after effects of polio all his life. I think the problem is that these anti-vaxers have never seen and don't understand the damage these diseases have caused in the past, nor do they think about what their choices will do for children too young to be vaccinated or people with weak immune systems like my sister. It's especially bad when people who catch measles go to the doctor's office and expose everyone there, with a higher likelihood of exposing people least able to deal with it. I know people who take medication to suppress their immune systems and people with weakened immune systems.

I feel if someone who did not get the vaccine by choice infects someone else who can't get the vaccine or who has a compromised immune system then that person should be responsible for all of the medical costs. I also think the exemptions should go away unless there is a medical need for the exemption. My state is already proposing this which I think is a good thing.

Someone's right to not get a vaccine should not trump my sister's right to live (she has a compromised immune system) or a baby's life.

A friend of my father's who works at Intel is one of these anti-vaccine nuts. She believes in using Chinese herbal medicine and refuses to let her baby be vaccinated and nothing we say seems to convince her otherwise.

Comment Re:What's Unique To Goto? (Score 2) 677

I was forced to take the introduction to programming class in college because the Turbo Pascal program I had used a goto for this very reason. In Pascal there was no break/continue equivalent and it would have been extremely messy in the code to not use the goto.

It later turned out that the professor did not know Pascal at all when there were simple errors in a 2 page program that she couldn't get to compile. I only showed up for the midterms and final for that useless class. The next one was worse since the professor disallowed using repeat/until, requiring recursion for everything claiming that it was just as fast since the compiler would take care of it (it wasn't, it was MUCH slower). Recursion does have it's place. Unfortunately most of the examples I see for it are places where it shouldn't be used.

Comment Re:GOTO is a crutch for bad programmers (Score 1) 677

And that non-standard indentation will cause nothing but trouble, especially in a large project. The lack of proper indentation makes the code harder to read than just using a goto, especially if someone works on it in a modern editor that does things like handling indentation for you.

Comment Re: GOTO is a crutch for bad programmers (Score 1) 677

Try using C++ in the Linux kernel or in a bootloader, the type of stuff I work on. Everything is C for a reason. That isn't to say that C++ can't be used at the kernel level since I worked on a large C++ OS/2 driver (around 100KLOC) years ago, but it took a lot of work to make C++ work in that case and it was extremely compiler dependent (I think it only worked with Watcom 10.0b, not rev c or any other version).

Comment Re:why? (Score 1) 677

A goto certainly makes cleanup code a lot easier, especially in my line of work on bootloaders, device drivers and other stuff. There are many cases where it is far cleaner to use a goto error_handler; in the code, especially if there are multiple locations and have all of the cleanup code in one place rather than duplicating it all over the place.

There are other times when a goto can also make sense, for example if you have multiple nested levels of logic you want to get out of it in a hurry. It takes an experienced programmer to know when to use it and when not to. I have seen many cases where a single goto or using goto for error handling makes the flow of the code much easier to read and where it can significantly reduce the size of the code. That's not to say that it can't be abused either. I have also seen cases where it makes the code more difficult to read but in most cases where I come across it it simplifies the logic flow and helps keep the code from being cluttered.

Comment Re:why? (Score 1) 677

Indenting the flow can get bad if it starts to get rather deep. In my case, the code bases I work on use 8-character tabs for indenting and also limit the code to 80 columns. It quickly grows difficult to read and maintain if you have to keep indenting when a simple goto error_handler is far easier to deal with and I have found less error prone and easier to read. The flow remains easy to read since the error handler is always at the end of the function.

Comment Re:why? (Score 1) 677

There is a time and place to use goto. It works well for handling error cases and can lead to better code.

Instead of:

rc = some_function()
if (rc) {
  do lots of cleanup of earlier stuff()
  return rc;
}

rc = some_other_function()
if (rc) {
  do even more cleanup()
  return rc;
}

I can just use:

rc = some_function();
if (rc)
    goto error_handler; ...
error_handler:
  perform any needed cleanup
  return rc;
}

The other method would be a huge nested mess of if/else conditions.

Slashdot Top Deals

FORTRAN is not a flower but a weed -- it is hardy, occasionally blooms, and grows in every computer. -- A.J. Perlis

Working...