This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: malloc attributes and realloc
On Fri, 2 Jan 2004, Jonathan Lennox wrote:
> This isn't directly relevant to the current thread, but another aspect of
> malloc-like functions came up recently: the memory they return is writable.
> I.e., if char *p was returned by an attribute(malloc) function, then
PR 3414 points out that malloc has several properties and that the
documentation needs to say which the malloc attribute implies. My
understanding is that the intention is that the attribute refers to the
nonaliasing property. Do we want to add other properties of malloc to the
definition of the attribute, or add new attributes for those properties.
In particular, do people have __attribute__((__malloc__)) functions which
don't necessarily return writable memory (say, constructing an object then
protecting the memory against future change)?
--
Joseph S. Myers
jsm@polyomino.org.uk