using standard interfaces

Richard Harter g-rh at cca.CCA.COM
Fri Sep 16 17:22:52 AEST 1988


In article <7076 at bloom-beacon.MIT.EDU> scs at adam.pika.mit.edu (Steve Summit) writes:

>The reason we keep pointing out the existence of standard
>functions to those who would rather (or have to) roll their own
>is to encourage people to start using the standard interface, by
>writing their own function with the same name and parameters,
>rather than sticking special-purpose code in-line, or inventing
>some new name.  This way the program can take advantage of
>standardized, optimized implementations when they become
>available (for instance when the program is ported to a different
>system which has them).

This sounds good, but there is a problem to take into account.  If
you have your own routine with the same name as the "standard"
routine there is the potential for problems when you port into
a system that has the "standard" routine in its library.  The
problem is that the library implementers may use said routine 
internally in the library in a way that conflicts with your routine.
For example, it is quite unsafe to roll your own storage allocator
and call it malloc.
-- 

In the fields of Hell where the grass grows high
Are the graves of dreams allowed to die.
	Richard Harter, SMDS  Inc.



More information about the Comp.lang.c mailing list