Re: [PATCH] __attribute_malloc__ for malloc-like functions

From: Date: Thu, 28 Aug 2003 14:51:34 +0000
Subject: Re: [PATCH] __attribute_malloc__ for malloc-like functions
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-4228@lists.php.net to get a copy of this message
    A check for 2.96 has been committed a while ago.  What do you
    think about adding the malloc attribute to functions which
    either return NULL or an emalloc'ed pointer?
If the return type is char* or void*, adding the malloc attribute would be appropriate. Aliasing isn't an issue for null pointers, because they can't be dereferenced anyway.
    I've also added a few other attributes in a couple of places.
    What do you think about the nonnull attribute?
This is merely a compile-time check, which is unnecessary if you don't initialize pointers to NULL if NULL is an inapproriate value. In that case (with -Wuninitialized enabled) GCC will give a warning that the variable is not initialized. I am not sure how nonnull is used in optimizations, though. Ard

« previous php.internals (#4228) next »