What is strdup() supposed to do? Does anyone have a copy?

Lars P. Fischer fischer at iesd.auc.dk
Thu Feb 21 05:46:12 AEST 1991


>>>>> dag at persoft.com (Daniel Glasser) writes:

Daniel>Nit #2: You should simplify your expression in the "malloc()", that is,
Daniel>		sizeof(char) * strlen(foo) + sizeof(char)
Daniel>	  could be written
Daniel>		sizeof(char) * (strlen(foo) + 1)

>>>>> jeff at onion.rain.com (Jeff Beadles) then said:

Jeff> Untrue.  What if sizeof(char) != 1?  Yours will break, and mine
Jeff> will work.

Gimme a break. Are you going to tell us that

	A * (B + 1) != A * B + A

for A != 1 ?? If you can't handle basic arithmetic, what makes you
think you can write a C program?

/Lars
--
Lars Fischer,  fischer at iesd.auc.dk   | Beauty is a French phonetic corruption
CS Dept., Univ. of Aalborg, DENMARK. |                   - FZ



More information about the Comp.lang.c mailing list