bug-autoconf
[Top][All Lists]
Advanced

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

AC_FUNC_MALLOC


From: Bruno Haible
Subject: AC_FUNC_MALLOC
Date: Tue, 29 Oct 2002 13:22:07 +0100 (CET)

The explanation of AC_FUNC_MALLOC suggests that correct malloc implementations
would not work. Citing the ISO C 99 standard, section 7.20.3:

    The pointer returned points to the start (lowest byte address)
    of the allocated space. If the space cannot be allocated, a null
    pointer is returned. If the size of the space requested is zero,
    the behavior is implementationdefined: either a null pointer is
    returned, or the behavior is as if the size were some nonzero value,
    except that the returned pointer shall not be used to access an object.

Therefore malloc(0) = NULL is completely standards compliant. Applications
that don't understand that should be fixed, instead of pushing a "replacement"
wrapper functions into the correct applications.

So I suggest that
  1. the name AC_FUNC_MALLOC be changed to AC_FUNC_MALLOC_COREUTILS,
  2. the documentation be updated to explain that the replacement function
     is needed only for programs that do not comply with C99.




reply via email to

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