strncpy

jss at jra.ardent.com jss at jra.ardent.com
Sat Dec 23 04:36:34 AEST 1989


In article <11515 at csli.Stanford.EDU> poser at csli.stanford.edu (Bill Poser) writes:
>
>I at least was not calling for a redefinition of strncpy in my
>posting, only asking whether there was a good reason for it to behave
>as it does. 

Not to pick on Bill, because I see questions like this all the
time in this newsgroup.  But this is not a well posed (groan moan, 
I couldn't resist :-) question because we don't know what kind of reason 
will be "good".  Do you want 

	Origin:		There was a glitch in the XYZ-1 architecture 
			that meant the routine was 10 times faster
			than the obvious alternative.

	Historical: 	When the code was moved from the XYZ-1 to the
			FOOBAR-990000000 this behavior was unmodified.
			On the DWIM-9 it was fixed, but when X3J11 decided 
			to standardize there weren't any DWIM-9's around
			and there were zillions of lines of code derived
			that dependend on the bug so they standardized 
			on the XYZ-1 behavior.

	Rationale:	It ought to work that way because ... 

Usually the dominant reason is historical, and frequently there
are no good rationales.  But is the historical explanation a
"good" one? 

Please, if you ask a question about why some library function
behaves the way it does, explain what motivates the question
(idle curiosity is fine with me) and what category of answer 
you're interested in. 

Jerry Schwarz



More information about the Comp.lang.c mailing list