Qualified Names mean you don't break the C Library

idallen at watmath.UUCP idallen at watmath.UUCP
Tue Jul 24 09:54:57 AEST 1984


If you don't have unique names for things like printf and getchar,
names that are identifiable so that no programmer will use them by
mistake, then you can never have one C Library routine call another C
Library routine, because the called routine might have been
accidentally redefined to do something that the Library doesn't
expect.  If I write a do-nothing function called malloc() and put it in
my program, every C Library routine that uses malloc() breaks.  This is
a bad thing.  I do not want to have to learn all the names of every
routine that ever is, was, or will be put in the C Library.  I want to
be told "if you never use an external name like such-and-so, you will
never break the library".  The C Library should be calling a special
internal name for malloc(); not a simple external name that you
are likely to stumble across.  If you *really* want to redefine the
Library's malloc, you redefine the internal name -- but, it is very
clear (by the form of the name) that you are doing something special.

The B Programming Language has reserved identifiers containing a
period for internal system use.  My programs call printf() -- the
library always calls .prntf().  If I never use an external with a
period in it, I never mess up the library.

Of course, this only works like this because most programs are
two-tiered -- my source, and the library.  When you start to apply
this to different libraries, each needing its own convention for
identifiers...  argh.
-- 
        -IAN!  (Ian! D. Allen)      University of Waterloo



More information about the Comp.unix.wizards mailing list