Much of the code that I need to fix seems to be written by people who learned on day one of programming that "whitespace doesn't matter to a computer" and never looked back.
Yes. I've even heard people justify their haphazard, random formatting by parroting the old "the compiler doesn't care about formatting" line they heard from the instructor at the technical college on the first day of their language course.
If the compiler was the only other entity with which you're collaborating on a project, fine. But in the real world other humans have to read your garbage.
I met someone once who called every variable X. Yes really. The compiler was somehow just supposed to figure out that X on this line and X on that line were different things... What is baffling is that he did have code that worked, kinda.
Unless there is a lot of creative abuse of operator overloading or macros lurking in there that code really doesn't look too awful compared to some monstrosities I've had to work with.
I agree. At first glance, I thought that the NbrofA/AA/etc names were just gibberish. The most nonsensical part to me is starting the for-loop iterator at zero, and then only executing the function if the iterator is non-zero.
Hm, did you check that each loop worked with its own loop variable? If not, how do you _know_ it does what you think it does?
If you code like this, you will have to be paranoid with each line you read. That is what makes such code bad, even if it does what it appears to do at first sight.
He still works a lot. Makes a lot of money. And his customers love him. (No, I don't think they review his code.)