Mac pointers and handles. Was: Chips that changed the world
roger.holmes at microspot.co.uk
Mon May 4 06:18:38 CDT 2009
> From: Ethan Dicks <ethan.dicks at gmail.com>
> Subject: Re: Chips that changed the world
>> Then of course there were those programmers that thought they were
>> clever, using the top 8 bits to store flags in pointers, etc. ?
>> messed up when upgrading to 68020 and up.
> I remember reading a warning against such practices the original Mac
> system manuals (the "hernia manuals"), but faced with 128K of RAM,
> early programmers did not universally heed the warning.
As I remember it, the warning was there because Apple had already used
the top eight bits of pointers to hold flags for locked, resource,
purge-able etc and if you wrote over them the OS crashed or made your
application crash when it overwrote your flags. A big chunk of one the
developer conference was going 32 bit clean, whereby developers had to
use system routines to test and set the flags instead of system macros
which had been compiled into our source code without us realising they
were macros. For instance it was normal to get the status byte of a
handle before locking it and instead of unlocking it, restore the
status byte. As these had been done using macros they just went
straight to the master pointer and acted on its top 8 bits. There were
also system calls or macros for extracting the lower 24 bits which
very few people had used as it worked without, but Apple wanted us to
use them so they could redefine them to do nothing later. Saving a few
bytes caused both Apple and its developers a huge amount of effort
Incidentally, you refer to the "hernia manuals". Do you mean the ring
bounds ones? At least you could split them up, volume 5 was the
problem one, it was a paperback about 2" x 8.5" x 11". Later there was
a volume about OCE (IIRC, Open Connectivity Environment) which was as
bad if not worse, but at least I never needed to read it, I think that
technology died because the application programmers were intimidated
by the size of the manual.
Does anyone here happen to have a copy of the original loose leaf
QuickDraw 3D manuals? Someone chucked out my copy at work thinking
they had been supeceeded, but they were far better than the later
documentation and still apply to the Quesa open source project I use
in my work. I would be willing to pay for them to be copied or
scanned, maybe they could go on BitSavers or be put in the official
Quesa documentation at SourceForge.
More information about the cctalk