Summary: definition of malloc(0) and ::operator new(0)

From: lbro_at_dscc.dk \(Lars Bro\) <"lbro_at_dscc.dk>
Date: Fri, 17 Jul 1998 13:53:19 +0200

It is uncertain what malloc(0) must return but according to:


 Accredited Standards Committee* Doc No:X3J16/96-0225
  X3, INFORMATION PROCESSING SYSTE WG21/N1043
                                        Date: 2 December 1996
                                        Project:Programming Language C++
                                        Reply to:Andrew Koenig
                                        AT&T Research
                                        PO Box 636
                                        600 Mountain Avenue
                                        Room 2C-306
                                        Murray Hill, NJ 07974 USA
                                        ark_at_research.att.com

(Which is the December 1996 version of the ANSI draft C++ standard)

5.3.4 New
...
...

8 When the value of the expression in a direct-new-declarator is zero,
  the allocation function is called to allocate an array with no ele-
  ments. The pointer returned by the new-expression is non-null and
  distinct from the pointer to any other object.
...
...

-- 
Lars Bro, DSC Communications a/s Denmark
e-mail: lab_at_dscc.dk  tel: +45 44 77 29 67
Received on Fri Jul 17 1998 - 13:54:21 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:38 NZDT