[英]Check if compiler is Turbo C++
我目前正在处理为Turbo C ++设计的遗留代码。 要解决Turbo C ++缺少bool
数据类型的问题,该程序包含以下代码行。
// Necessary when compiling with Turbo C++
enum bool {false, true};
大多数C ++编译器都无法运行带有error: expected identifier before 'bool'
的程序error: expected identifier before 'bool'
。 虽然我希望切换到更新的编译器,但遗憾的是我需要维护此解决方法以实现向后兼容性。
我怎么能指出这个特定的代码行只能在Turbo C ++中编译?
正如Thomas Matthews和selbie在评论中所建议的那样:
#ifdef __TURBOC__
// Only runs if compiler is Turbo C++
enum bool {false, true};
#endif
资料来源: http : //beefchunk.com/documentation/lang/c/pre-defined-c/precomp.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.