On 5/27/2012 2:29 AM, Jeremy Farrell wrote:
From: Jakob Bohm [mailto:jb-open...@wisemo.com]
On 5/25/2012 5:30 PM, Ken Goldman wrote:
On 5/25/2012 3:33 AM, Jakob Bohm wrote:
ANSI C and POSIX free() is NOT required to handle free(NULL)
as a NOP.
I checked reputable sources (Plauger, Harbison and Steele, the ANSI
spec, and the IEEE POSIX spec).
All agree that (e.g. ANSI)
"If ptr is a null pointer, no action occurs."
Which version of the ANSI Spec, and where did you get a copy?
I quoted from C99 in a recent message; can't remember where I got it (12 years
ago ...), perhaps Techstreet. There are 'final drafts' of C99 and C11 legally
available for free on the web I believe.
Various revisions of POSIX are available free for reference online; the current
POSIX.1-2008 at http://pubs.opengroup.org/onlinepubs/9699919799/ and the older
POSIX.1-2004 at http://pubs.opengroup.org/onlinepubs/009695399/
Note that when considering portability, C99 is not yet
fully implemented everywhere, so when I say "ANSI C"
without qualification, I generally refer to C89 plus
the two TR update documents that mostly focused on
things many compilers were already doing.
Having no current access to the C89 standard or its
drafts, I am relying on the experience that many "C89"
real world systems I have encountered did not tolerate
free(NULL). In contrast all recent C++ specifications
(starting with The C++ Programming Language 2nd Ed.
which preceded all published standards), insist that
delete (char*)NULL must be a safe NOP.
As C99 adopted many other features from C++ (such as
declarations between statements), the free(NULL)
behavior might also be new in C99.
Enjoy
Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S. http://www.wisemo.com
Transformervej 29, 2730 Herlev, Denmark. Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager majord...@openssl.org