On Mon, Sep 17, 2001 at 02:30:22PM -0500, Gibbs Tanton - tgibbs wrote:
> Well, that explains the last Purify issue.  Whenever we substr out 0 bytes
> to a NULL register, we create a string by malloc(0).  If we later print that

Not so.  Depending on the implementation malloc(0) may do any of
the following:

(1) return a unique pointer
(2) return NULL
(3) crash
(4) return a pointer to a naughty address so that we'll crash later
(5) return a pointer to the collected works of Herodotos

Of course, in practice only the two first choices are often seen.
But both are possible.

> string, then we pass in 0 to printf.  I thought that printf would not look
> at its argument if the length specifier was 0, but apparently on your system
> it does.  So, it appears we have two options:
> 
> 1.) Ignore the error
> 
> 2.) Put an if statement around the print and have it not print if the
>     string is of length 0.

3.)  Do not use malloc(0).

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Reply via email to