Date: Mon, 29 Jul 1996 09:11:33 +0200 (IST) From: Eli Zaretskii To: Conrad Wei-Li Song Cc: djgpp AT delorie DOT com Subject: Re: Malloc and realloc pains... In-Reply-To: <199607290226.VAA01065@smtp.utexas.edu> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Sun, 28 Jul 1996, Conrad Wei-Li Song wrote: > Borland returns a NULL pointer on a malloc( (size_t)(0) ); The ANSI C Standard specifies that the behavior in this case is implementation-defined. I guess if they say that, there are other libraries out there that behave that way. Solution: don't call `malloc' with a zero argument, period. (IMHO, whoever steps into a territory marked with ``implementation-defined'' or ``undefined'' signs is just looking for trouble.) > Microsoft does not deallocate the passed memory block on a failed realloc. That is what ANSI C specifies it should do. If you see a `realloc' that behaves differently, then that other `realloc' is buggy.