| Perfil de ChuanbinBruce's lifeFotosBlogListas | Ayuda |
|
05 junio gcc 中宏定义的问题如果在gcc/g++中使用-D参数预定义宏时,需要注意gcc/g++间各个参数的数据。-D参数一定要在-I、-L参数之前;而且最好靠前操作。
-D参数可以预定定义的宏的长度不限,但是肯定也不能太长。 ===================== Example======================
例子如下:
bash-2.03$ more elif.cpp #include <stdio.h> int main() { #ifdef MACRO1234567890 printf(" DEBUG1 \n"); #elif defined(DEBUGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2) printf(" DEBUG2 \n"); #else printf(" DEUBG3 \n"); #endif return 0; } bash-2.03$ gcc -DMACRO1234567890 elif.cpp -o elif bash-2.03$ ./elif DEBUG1 bash-2.03$ gcc -DDEBUGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2 elif.cpp -o elif bash-2.03$ ./elif DEBUG2 bash-2.03$ gcc elif.cpp -o elif bash-2.03$ ./elif DEUBG3 算法应用的几个思考(1)对于任何一个优秀的算法,在某些条件下他的效率是很低,这是算法设计过程中难免的。所以要根据算法本身特点,设计使用算法的环境,使得该算法能够长期、大概率的运行于其效率最高的部分。这个是算法和算法应用的思考。
(2)…… 02 junio C/C++ Predefined MacrosThe compiler recognizes 10 predefined ANSI C macros, and the Microsoft C++ implementation provides several more. These macros take no arguments and cannot be redefined. Their value, except for __LINE__ and __FILE__, must be constant throughout compilation. Some of the predefined macros listed below are defined with multiple values. See the following tables for more information. ANSI-Compliant Predefined Macros
Microsoft-Specific Predefined Macros
As shown in following table, the compiler generates a value for the preprocessor identifiers that reflect the processor option specified. |
|
|