A tale of two C's.

00704a-Liber nevin1 at ihlpf.ATT.COM
Thu Apr 28 10:45:10 AEST 1988


In article <195 at sdeggo.UUCP> dave at sdeggo.UUCP (David L. Smith) writes:
>In short, I feel that being able to replace library routines is 
>necessary for two reasons:  To achieve a difference in functionality 
>without recoding the rest of the library routines which depend on the 
>one you want to change and to fix bugs when you don't have a source 
>license.

I disagree with both these reasons.  First, by replacing a library routine
with your own you might still have to recode the rest of the library
routines which depend on the one you want to change.  Although your
programs should make the assumption that they can only be dependent on the
*description* of a library and independent of its' implementation, the
implementor of the library routine is not bound by these restrictions.
Also, you get name-space violations (how does cc know which function to
call?  Should it always call the new one??  If you define a third one,
which one should we call??) and will very likely have
problems using shared libraries.

Point 2:
If you want to change library routines for your program only, use
statements like

	#define	strcpy(s1, s2)	my_string_copy(s1, s2)

which makes this very explicit, and you don't need a source license.

-- 
 _ __			NEVIN J. LIBER	..!ihnp4!ihlpf!nevin1	(312) 510-6194
' )  )				"The secret compartment of my ring I fill
 /  / _ , __o  ____		 with an Underdog super-energy pill."
/  (_</_\/ <__/ / <_	These are solely MY opinions, not AT&T's, blah blah blah



More information about the Comp.lang.c mailing list