This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: 'malloc' attribute?
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Chris Lattner <sabre at nondot dot org>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 26 Feb 2003 15:23:53 -0800
- Subject: Re: 'malloc' attribute?
- References: <Pine.LNX.4.44.0302261652400.20767-100000@nondot.org>
Chris Lattner <sabre at nondot dot org> writes:
> Apparently C99 doesn't allow declaring a function to return a 'restrict'
> pointer (GCC rejects it at least), but GCC does allow you to attach the
> malloc attribute to a function. It seems to me that this is the exact
> same information, ie, the following two function prototypes should be
> equivalent:
>
> restrict int* foo(); // Currently rejected with -std=c99
You've got the 'restrict' in the wrong place: try
int * restrict foo();
which attaches the qualifier to the pointer, not the thing it points
to.
I don't know whether or not that's the same thing as attribute malloc.
zw