TRUE and FALSE

Tim McDaniel mcdaniel at adi.com
Wed Sep 12 02:44:17 AEST 1990


Ye gods, folks, get a clue!

george at hls0.hls.oz (George Turczynski) writes:

   Don't think for one second that I would entertain the idea of using
   these macros!  Felix Lee posted his set, some of which expanded to
   200,000++ characters.  Thinking this was ridiculous, and that I
   might save some people wasting too much of their time, I posted the
   same (but improved) macro set, that didn't waste so much space.

Felix Lee was indeed being ridiculous -- deliberately.  It is called
"satire", a subclass of the class "joke".  Specifically, he was
"making fun" of the whole TRUE/FALSE definition topic.  Trying to
"optimize" those macros was itself a complete waste of time.

My own contribution was
>
> I rather like the way I did CONS.  I didn't want the overhead of
> checking for free space and allocating more on every call.  Basically,
> it increments the free-store pointer and just dereferences it.  If
> it's a bad pointer now, a signal handler does an "sbrk" to get a lot
> more space, and it restarts the instruction that failed.  And it's so
> portable -- at least, it worked on every VAX that I tried it on.
>
> Have I mentioned dereferencing NIL yet, to get 0?
>
> By the way, would anyone like a copy of the shell I wrote in this
> LISPish C?  I call it "The Still-Bourne Shell".

NOTE: THESE WERE ALSO "JOKES", as may be inferred from the
"portability == VAX" line.  Among other things, signal handlers on
some machines cannot or do not restart the instruction that failed.
Also, "(char *) 0" can be dereferenced in a *few* operating systems to
get '\0', but on most architectures, it causes a fatal error or
fetches garbage.  (See the "Frequently-Asked Questions" list.)

The original Bourne shell (called /bin/sh on most machines) was
written in pseudo-Algolish C, and used the "sbrk" kludge to do memory
allocation.  It was a maintenance nightmare and ridiculously
unportable, and basically had to be rewritten.
--
Tim McDaniel                 Applied Dynamics Int'l.; Ann Arbor, Michigan, USA
Work phone: +313 973 1300                            Home phone: +313 677 4386
Internet: mcdaniel at adi.com                UUCP: {uunet,sharkey}!amara!mcdaniel



More information about the Comp.lang.c mailing list