Variable Names in C code...

Someone over at the MSDN blogs recently posted a mini-rant about people using inscrutable variable names in short apps...

He mentioned that some people use things like i, and others use random letters like x. Believe it or not, there is actually some structure and reasoning behind these choices of variable names, and a certain amount of historical convention to it.

Reasons for using i, j, k as loop variable names:

These are mathematical (or engineering) index variables. Typically you'll see them used in matrices. i indicates the row, j the column, and k? Well, you get the idea.

Reasons for using x, y, z as loop variable names:

These are used when you're iterating over space - x indicates going across a row of pixels / space, and y indicates going vertically down that row of pixels / space. z, of course, goes into the page.

The only other version I've seen is l,m,n - used on the Sinclair Spectrum, because hitting the L key the first time gives you the token for the BASIC FOR command, whereas hitting it the second time gives you L - which is handy as you can rationalize it as "loop variable".

Using i, ii, iii is, however, incorrigible and encourages errors - any repeated single-letter name is going to give you trouble, as you can easily misread it.

Using i, ii, iii, iv, v, vi, vii, viii, ix, x, however, will lead to you being cudgeled to death with a sundial by a software engineer.


Saved by the bell...

In an amazing reversal of fate ... we're back in business.


Our CEO ... boy... he cuts it fine. But he does a damn good job :)

This entry was posted under Me. Bookmark the permalink.

Layoffs impending in 3... 2... 1...

Looks like we're outta here. *sigh*

Rock Bottom Brewery, here we come. Because, after all, there's only one place to go when you hit rock bottom - and that's Rock Bottom!

I've loved working with the people I work with. Damn. It has been a lot of fun, and we tried to do something great and wonderful ... but we just didn't get there. I don't think our reach was bigger than our grasp - we should have made it. But we didn't.

Add to that the fact that my car died last night and as a result is now in the shop, a volcano is about to go off in my back yard, and my wife got a demand from the IRS for back taxes, and we're pretty much having a peach of a week this week.

Still, this afternoon we'll toast the company off with a little Peruvian Brandy called Pisco, which I bought in Lima when I was there earlier this year. It's good stuff - almost tastes like the smoothest tequila you've ever had. Do a shot for the Inca gods, and see if we can get our gold idols up and running.

This entry was posted under Me. Bookmark the permalink.

Correct Idioms: Early Adapter

Folks, please, don't make the mistake that one head of marketing at Sierra I used to know did (and fought me tooth and nail on it, insisting that they were correct), and call the people you're relying on to buy your product early in the game early adapters.

The phrase you are looking for is early adopter. Note the 'O'. This is someone who is part of the first vanguard of people to ever use a new thing. They adopt the thing early on. (Adopt meaning "to take up and practice as one's own").

An early adapter, however, is someone who takes something early on, and like McGuyver or the A-Team, adapts it to their own nefarious purposes. This usually involves and/or incorporates duct tape somewhere in the process, a pocket-knife, and potentially a Sharpie permanent marker.

Big difference.

Similarly, one I saw today was regarding people doing things on mass. People, it's French. en masse - as in, in a large group. At least with this one, there's always the excuse that it's written in a completely different language.


Triptych of Wind and Rain

Did you ever consider that three hurricanes in two months is a bit much?

Poor Florida.

Actually... maybe it's not an accident... perhaps, just perhaps... (and bear with me here)... perhaps it's God's way of telling the Floridians to not fuck up a second time and vote George Bush back into office.

Although I do think that destroying all of the voting machines with 130mph winds is going a bit far - after all, there's that whole free will thing to consider.


subscribe via RSS