This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]