Strcpy fun w/ Ultrix

Liber nevin1 at ihlpb.ATT.COM
Wed May 3 10:33:17 AEST 1989


In article <cYLAeIy00Vsn02rps8 at andrew.cmu.edu> bobg+ at andrew.cmu.edu (Robert Steven Glickstein) writes:
|> Excerpts from ext.nn.comp.lang.c: 27-Apr-89 Strcpy fun w/ Ultrix tim at scsmo1.UUCP (618)

|> strcpy(x->name=malloc(strlen(in)+1),in);

|Bad programming style alert!

|Do you WANT to dump core if malloc returns NULL?

Sometimes this leads to a better chance of recovery than some of the
other ways I've seen programs handle this situation (such as not being
able to do anything at all, for instance).  All things considered, I
would rather have a graceful recovery.

Oh, well.  
-- 
 _ __	NEVIN ":-)" LIBER  nevin1 at ihlpb.ATT.COM  (312) 979-4751  IH 4F-410
' )  )			 "I will not be pushed, filed, stamped, indexed,
 /  / _ , __o  ____	  briefed, debriefed or numbered!  My life is my own!"
/  (_</_\/ <__/ / <_	As far as I know, these are NOT the opinions of AT&T.



More information about the Comp.lang.c mailing list