Log in

No account? Create an account
Andrei in the office


Andrei's Universe

One man's journey from infinity to nothingness

Previous Entry Share Next Entry
Andrei in the office

If I had a dollar...


Well, so.. I'm on speed. Unintentionally. The good side effect is that I'm coding the hell out of my project.

The bad news... I'm being sloppy. My complex algorithm that I spent weeks on was crashing. Really badly.

So after about 45 minutes of debugging I found the little bastard. I'm going to post it here. If people want an explanation... I can give it. Those of you who actually know code... see if you can see the stupidity I did.

	if (currDepth != newDepth) {
		NSUInteger popCount = currDepth - newDepth;
		NSUInteger popCounter;
		for (popCounter = 1; popCounter <= popCount; popCount++) {
			[[self parserStack] pop];

Oh, I feel like such a moron.

We now return you to your previously scheduled morning.

  • 1
God that's funny.

I think I'm going to use this as a justification for sticking to ii, jj, or kk for my loop counters.



You should have made it a const when you declared it, the compiler would have caught this for you (at least in C++)

Actually, I'm in Objective-C.... OOOOOOOOHH

People have complained when they look at my code that I tend to use FORTRAN-like naming conventions--I was even dinged on an annual review because of that--but you'll never confuse i and len:
for (i = 1; i <= len; len++) {

Pretty obvious when you use that crufty ol' C or FORTRAN programming style...

Most of the people at work prefer Hungarian (Play scary music now!)

Apps Hungarian makes sense:
for (indexCounter = 1; indexCounter <= lenCounter; indexCounter++) {

But System Hungarian--that bastard that most people at Microsoft advocates which seems like pointless nonsense to me (and proves a theory* of mine)--makes no sense:
for (lPopCounter = 1; lPopCounter <= lPopCount; lPopCount++) {

There is no additional semantic information; just that useless 'l' prefix.

(*My theory is that most computer programmers strive subconsciously for two goals: complexity--which is misinterpreted for progress--and laziness. Thus, most code is over-engineered unnecessarily so as to give a false feeling of progress. Systems Hungarian is perfect for adding unnecessary complexity to give that false feeling of progress: after all, it is easier (and lazier) to create variables like lpfnCallback--though it looks complicated--than to think through the algorithm you're writing...)

yah, now I feel well justified in sticking to i and j etc.

If I had a doller...

An 'er' err? Arrh!

- Olof

  • 1