[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Windows realloc & GNU

From: Conrad T. Pino
Subject: RE: Windows realloc & GNU
Date: Tue, 20 Sep 2005 15:24:25 -0700

> From: Derek Price [mailto:derek@ximbiot.com]
> Assuming you mean that this works, I think it will be fine:
>     p = realloc (NULL, 0);
>     free (p);

This definitely works:

        char c, *p;

        p = realloc (NULL, 0);
        c = p[0];
        free (p);

Referencing p[0] is fine, writing p[0] is NOT a trap or fault.

IMO debug run time library "free" does a guard byte test.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]