Suppose my program is:
typedef int MYINT;
int main()
{
MYINT x = 5;
........
do_something()
........
/* I wanna test whether MYINT is defined or not */
/* I can't use: ifdef (MYINT), since MYINT is not a macro */
........
return 0;
}
Actually, I encountered this problem while I was using a cross-compiler for vxworks. The cross-compiler header file included: typedef int INT.
But, my stack’s header file used:
#ifndef INT
#define int INT
Can you please suggest how to test typedefs, whether they are defined previously or not?
Thanks in advance.
No, this is not possible. Your best option is to use
typedefyourself, since redefinition of atypedefis an error.(I suppose you didn’t really want to
#define int INT🙂