Board index » cppbuilder » Test whether a typedef has been done?

Test whether a typedef has been done?


2008-03-25 03:12:07 AM
cppbuilder66
I'm trying to maintain some source code over 3 different tool chains (CG CP 2007, MS VS 2003, gcc 3.3.*) and have hit multiple lines that do:
typedef signed char int8_t;
Is there a way to test whether _int8_t is defined just as one can test for previous #define lines? Does #if defined only apply to #define defines?
 
 

Re:Test whether a typedef has been done?

"Randall Parker" < XXXX@XXXXX.COM >wrote in message
Quote
Is there a way to test whether _int8_t is defined just as
one can test for previous #define lines?
No. You would need to use an actual #define in all units that define
uint8_t, ie:
#ifndef INT8_T_DEFINED
#define INT8_T_DEFINED
typedef signed char int8_t;
#endif
Quote
Does #if defined only apply to #define defines?
Yes.
Gambit