Path: utzoo!attcan!uunet!seismo!dimacs.rutgers.edu!rutgers!usc!wuarchive!sdd.hp.com!decwrl!ucbvax!bisco.kodak.COM!bilbo From: bilbo@bisco.kodak.COM (Charles Tryon) Newsgroups: comp.lang.c Subject: Re: Just a minor new twist on free() Message-ID: <9010111342.AA18267@bisco.kodak.COM> Date: 11 Oct 90 13:42:13 GMT References: <1990Oct10.155448.1465@Neon.Stanford.EDU> Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: nobody@Kodak.COM Organization: Eastman Kodak Company; Rochester, NY Lines: 36 In <1990Oct10.155448.1465@Neon.Stanford.EDU>, dkeisen@Gang-of-Four.Stanford.EDU (Dave Eisen) writes: > In article <11@christmas.UUCP> rtm@island.uu.net (Richard Minner) writes: > >In article <8026@scolex.sco.COM> seanf (Sean Fagan) writes: > >>And now an ANSI compliant library must have free() check for a NULL > >>parameter, which means that, instead of 10000 tests, you are now doing 20000 > >>tests. Yep. Just love those performance increases, don't you? > > > >The ANSI behavior for free() is a good thing. I don't want to read > >any more complaints about it ;-) > .... > I'd prefer free not check for NULL pointers because I'd rather have > my sloppy (and probably incorrect) programming caught by a core dump > than slipping by untouched. I never check for NULL pointers in library > routines that I write unless there is a useful action that should be taken > when that pointer is NULL. Wouldn't it be more graceful to check for invalid data (such as, but not limited to NULL pointers), and on an error condition print a MESSAGE and exit gracefully (perhaps with a core dump to allow a debugger to give you trace-back information). Assuming that a program will crash is a very dangerous thing (not to mention, not very friendly), since it might choose instead to just hose up memory and continue on as if nothing had happened. Remember that YOU probably won't be the only person using your software, and other people strongly frown upon unexplained crashes. > Dave Eisen Home: (415) 323-9757 -- Chuck Tryon (PLEASE use this address, as Kodak foobars one in header!) USmail: 46 Post Ave.;Roch. NY 14619 B. Baggins <<...include standard disclamer...>> At Your Service "Then again, squirrels could be stupid." (D. Mocsny)