Programming at the Crack of Dawn
On How to Crack a Soft-Boiled Egg
A Tale of Two Endians
It’s early morning as I make my way in to work, suffering through caffeine
withdrawal yet I live in mortal fear of the coffee maker and thus am forced to await the
talents of those who seem better able to tame the tall metal beast. Somewhere a rooster
crows. I look out my fifth floor window and as sun and shadow creep across yonder
building I see a pigeon perched on the ledge. Cooing. Close enough.
This morning as I contemplate the chores ahead of me I sit and think, while
peeling a banana, about a puzzle that had been recently posed by one of my colleagues; a
puzzle that had more to do with on which side one cracks open a soft-boiled egg than
with how one peels a banana.
“What might you expect this function to return?” he asked as he scrawled this
little poser on our tiny whiteboard:
void f(unsigned short *p)
*p = 1;
unsigned long v = 0;
It had been crunch time for an entire week as we all struggled day and night and
into early morning hours to cut a stable release of our new software. All of us during this
time kept digging up little nuggets such as these, nuggets to which no one would lay
claim to having buried, yet were nonetheless welcomed curiosities posed by those who
found them, and when you’re eyeball deep in the inevitable bugs and syntax errors that
one faces when porting software from one platform to another, any diversion will do.
And besides, who are we programmers if not the insatiable solvers of puzzles?
Those of us who cared to take a crack at it sat or stood in quiet contemplation,
some of us scratching our bald spots on the tops of our heads, or pulling at our graying
beards, or just standing with hands in pockets quietly shuffling our feet. And then it hit
me. We are, after all, a multi-platform shop, and while at first someone might look at this
and say, “One…uh…right?” I instead asked him under which operating system was this
It was a