[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: probing for compiler attributes?
From: |
Joshua Hoblitt |
Subject: |
Re: probing for compiler attributes? |
Date: |
Wed, 8 Aug 2007 15:29:23 -1000 |
On Tue, Aug 07, 2007 at 08:43:54PM -0400, John W. Eaton wrote:
> Ugh. Don't do it like that. Instead, write something like
>
> your-config-header.h:
> --------------------
> #ifdef __GNUC__
> #define ATTR_MALLOC __attribute__((malloc))
> #else
> #define ATTR_MALLOC
> #endif
>
> and then in your code, just use
>
> #include "your-config-header.h"
> ...
> void *myfunc (char *myvar) ATTR_MALLOC;
The more I think about it the more I think this is a bad idea for
library code. It certainly makes the code more tidy but doesn't this
end up screwing any application that tries to link against your code? I
don't ever install config.h.
-J
--
pgpYoTnh4ztgs.pgp
Description: PGP signature