programming in the
twenty-first century

It's not about technology for its own sake. It's about being able to implement your ideas.

Kilobyte Constants, a Simple and Beautiful Idea that Hasn't Caught On

Eric Isaacson's A86 assembler (which I used regularly in the early 1990s) includes a great little feature that I've never seen in another language: the suffix "K" to indicate kilobytes in numeric literals. For example, you can say "16K" instead of "16384". How many times have you seen C code like this:

char Buffer[512 * 1024];

The "* 1024" is so common, and so clunky in comparison with:

char Buffer[512K];

In Forth this is trivial to add, at least outside of compiled definitions. All you need is:

: K 1024 * ;

And then you can write:

512 K allot

permalink July 20, 2008



twitter / mail

I'm James Hague, a recovering programmer who has been designing video games since the 1980s. Programming Without Being Obsessed With Programming and Organizational Skills Beat Algorithmic Wizardry are good starting points. For the older stuff, try the 2012 Retrospective.

Where are the comments?