This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: 'malloc' attribute?
- From: Chris Lattner <sabre at nondot dot org>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 26 Feb 2003 17:15:08 -0600 (CST)
- Subject: Re: 'malloc' attribute?
> 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
> int *foo() __attribute__((malloc));
Err... sorry to respond to myself, but I see the error of my ways:
int * restrict foo();
int *foo2() __attribute__((malloc));
... is the test I intended, and is, in fact, accepted by gcc. So, is
there any difference between these two declarations?
-Chris
--
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/