Friday Dec 05, 2008

asc("") and printf("%s",NULL)

A few days ago I was reminded of one of the differences between Solaris and GNU/Linux which caused a few headaches for Sun's desktop team back in the days of GNOME 1.2. The problem is that while you can printf("%s",NULL); in most Linux distributions, doing the same in Solaris caused the executable to exit and generate a core. There were some debates about the correctness of each approach. Should the program crash to tell the developer that he shouldn't be trying to print a NULL string (the Solaris behavior) or should the program continue happily along printing a NULL pointer? I can see some advantages in both approaches I suspect this and other "Linuxisms" will end up in OpenSolaris simply because they make it more convenient for average coders to throw together a quick and dirty program or for someone to compile and run the thousands of source packages out there which (perhaps unknowingly) take advantage of this Linuxism.

But thinking about this reminded me of a similar "bug/feature" in my very first computer, the Commodore 64 back in 1982 when 64K seemed an unbelievably excessive amount of memory for a computer which cost only $595. The built in blitter and 4 channel 16 bit synthesizer made it a really fun computer for me to write simulations and sound generator programs for my father's physical science class. If you look closely at many of the programs which were published for Compute! and other magazines of the time, you might notice something strange. When a character was read from the user (e.g. via get (a$) ), the asc(a$) function would convert the character to its numeric ASCII value. But in the code you would usually see something like this:

n = asc(a$+chr$(0))

J64 java emulator

What is going on here? There was a bug/feature in Commodore 64 BASIC V2 which raised an "Illegal quantity error." whenever a null string was passed to the asc() function. The Commodore 64's 6510 processor had the unusual ability of being able to peek the ROM and write to shadow RAM which shared the same address space and then disable ROM so that BASIC was running from RAM. This allowed modifications to the BASIC interpreter. Jim Butterfield, a Commodore expert and author once demonstrated a one byte poke which fixed this asc("") bug. Ever since I learned of this simple fix, I wondered why so many BASIC's had this same one byte bug. The Commodore 64, Vic-20, Atari, Amiga, and at least some versions of the Apple and IBM PC Basic's shared this same bug! What was going on? Well, as it happens, a little company known as Microsoft wrote versions of BASIC for nearly all 8 bit computers of the 1980s and 1990s. Was this one byte bug overlooked by Microsoft and propagated to all Microsoft inspired codebases or were Microsoft's developers following the same purist philosophy as Solaris developers who assert that "good coders shouldn't pass NULL into string functions?" Either way, when such a company grows to what it has now become, it can decide that this one byte bug is actually a feature.

Tuesday Nov 27, 2007

Obama steps into the open file format debate

During a talk at Google, Barack Obama mentioned that he would like to promote "universally accessible formats" for government information. News analysts are wondering why Obama would want to enter this debate. Government de facto support for proprietary standards owned by Microsoft impacts nearly everyone by forcing us to buy Microsoft's products. But this is understood only by a small technical minority and so normally wouldn't get any play in an electoral culture centered around "sound bites" and visceral reactions to pseudo issues which impact virtually no one but which make for emotive campaign advertisements. The fact that Obama mentioned file formats is probably an accident, but it would be nice to pretend that he is trying to drag electoral debates up to a higher level.

Monday Sep 03, 2007

Irish standards authority disapproves (with comments) OOXML ISO fast track

The National Standards Authority of Ireland (NSAI) has voted Disapproval-with Technical Comments in response to Microsoft's OOXML submission to ISO/IEC JTC 1 as a candidate ISO/IEC standard. While Ireland's conditional disapproval might not carry the clout of China's and India's no votes, it is reassuring that such a small country with a big Microsoft presence has the courage to say no.

[Read More]

Thursday Apr 19, 2007

An economic analyst vs Microsoft Windows Vista

Lets face it, most operating system installers aren't fun. If Microsoft Windows weren't pre-installed on more than 90% of desktop PCs, I suspect more than a few PCs would be sitting at BIOS boot prompts. But if the experience of my favorite blogging economist is any indication, even when you have a monopoly and your OS is pre-installed on 90% of new PCs, you can still screw up the initial user experience. Michael Shedlock is a economic analyst with an interesting view on everything from global property bubbles to currency carry trades to the goofy and dangerous actions of the Federal Reserve board. But give him a new laptop with Windows Vista pre-installed and pretty soon there's blood on the floor (literally!)

[Read More]



« April 2014