'malloc' attribute?
Zack Weinberg
zack@codesourcery.com
Wed Feb 26 23:27:00 GMT 2003
Chris Lattner <sabre@nondot.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
More information about the Gcc
mailing list