Where can I find a list of predefined symbols for C51? I'm trying to write a set of portable library routines and I can't figure out how to tell that the file is being compiled by C51.. So I can do something like: #ifdef __keil_c51__ //keil specific routines #endif I'm using an old version of the compiler, v5.10. Thanks in advance.. Scott
No, #ifdef __C51__ is exactly what you want! This is a pre-processor construct which tests whether or not the pre-processor symbol __C51__ is defined; it does not expand the symbol! This is the standard way to check what model of compiler you have; eg,
#if defined __C51__ //Keil-specific stuff #elif defined __BORLANDC__ //Borland-specific stuff #elif defined _MSC_VER //MSVC-specific stuff #else #error Unsupported compiler #endif