delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/10/27/14:22:14

To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: FREEing NULL pointers
Organization: Code Generation Technology, San Francisco, CA
Date: Tue, 27 Oct 92 10:45:24 -0800
From: "Thomas J. Merritt" <tjm AT netcom DOT com>

|Assuming that free can handle NULL is invalid, unless you are sure
|that it's *supposed* to be ANSI compliant.  Trying to free NULL also
|implies that your program isn't checking the validity of pointers it
|is dealing with.

ANSI is pretty clear about what free should do on a null pointer.

Sec. 4.10.3.2 pg. 155/36

	... If ptr is a null pointer, no action occurs. ...

I'de classify this as a bug in the library.  My guess is that berkeley
has fixed this for 4.4 BSD since they have put a lot of effort into
standards conformance..

TJ Merritt
tjm AT netcom DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019