A
Anthony de Almeida Lopes
Hello,
I am wondering why it is not possible to have a function-like macro like
the following:
#define __nothread(name) do { \
#ifdef _PTHREAD_H \
#warning "name is not a thread safe function" \
} while (0)
I get the error "test.h:2:2: '#' is not followed by a macro parameter"
Actually, the exact goal is to have a prototypes such
as:
__nothread int function(void);
which would generate a warning when compiled with _PTHREAD_H or
_REENTRANT defined.
Is this possible?
I am curious how __attribute__ works internally. Right now I'm looking
through the gcc-3.3.4 source; so, hopefully I'll find the answer to that.
Thanks,
-Anthony
I am wondering why it is not possible to have a function-like macro like
the following:
#define __nothread(name) do { \
#ifdef _PTHREAD_H \
#warning "name is not a thread safe function" \
} while (0)
I get the error "test.h:2:2: '#' is not followed by a macro parameter"
Actually, the exact goal is to have a prototypes such
as:
__nothread int function(void);
which would generate a warning when compiled with _PTHREAD_H or
_REENTRANT defined.
Is this possible?
I am curious how __attribute__ works internally. Right now I'm looking
through the gcc-3.3.4 source; so, hopefully I'll find the answer to that.
Thanks,
-Anthony