On Wed, 2005-06-29 at 15:19 +0300, Lauri Nurmi wrote:
> So, basically, is there a reason why sqlite3Malloc(n) & co should even
> try to allocate zero bytes, instead of just returning NULL if n==0? Does
> a pointer pointing to zero bytes of memory have any use anyway?
> 

Yes.  A NULL return from sqlite3Malloc() is an error condition meaning
that you have run out of memory.  That is very different from returning
a zero-length memory allocation.

You wouldn't want to substitute a NULL for an empty string in SQL would
you?  Having sqlite3Malloc return NULL for a zero-length allocation is
roughly the same thing.
-- 
D. Richard Hipp <[EMAIL PROTECTED]>

Reply via email to