声明:
1、本翻译仅供个人学习使用,本人没有提供技术支持的义务,也不承担由此引发的任何后果。
2、请勿用于商业用途。
3、英文来自:http://www.keil.com/support/man/docs/c51/。
4、欢迎大家共同与我交流探讨(290207203@qq.com)。
NOINTPROMOTE Compiler Directive
Abbreviation | NOIP | ||||||||
Arguments | None. | ||||||||
Default | INTPROMOTE | ||||||||
µVision | Options — CX51 — Enable ANSI integer promotion rules. | ||||||||
Description | The NOINTPROMOTE directive disables ANSI integer promotions. Integer promotions are normally enabled to provide the greatest compatibility between the C51 Compiler and other ANSI compilers. However, integer promotions can yield inefficient code on the 8051. | ||||||||
See Also | |||||||||
Example | C51 SAMPLE.C INTPROMOTE #pragma intpromote C51 SAMPLE.C NOINTPROMOTE The following example: stmt lvl source 1 char c; 2 unsigned char c1,c2; 3 int i; 4 5 main () { 6 1 if (c == 0xff) c = 0; /* never true! */ 7 1 if (c == -1) c = 1; /* works */ 8 1 i = c + 5; 9 1 if (c1 < c2 +4) c1 = 0; 10 1 } demonstrates code generated using both the INTPROMOTE and NOINTPROMOTE control directives.
|
NOINTPROMOTE 编译器伪指令
缩写 | NOIP | ||||||||
参数 | 无。 | ||||||||
缺省 | INTPROMOTE | ||||||||
µVision | Options — CX51 — Enable ANSI integer promotion rules. | ||||||||
描述 | NOINTPROMOTE 伪指令禁止 ANSI 整型提升。 整型提升一般是使能的,对C51 编译器和其他 ANSI 编译器提供最大的兼容。但是,对 8051来说,整型提升产生低效率的代码。 | ||||||||
参考 | |||||||||
示例 | C51 SAMPLE.C INTPROMOTE #pragma intpromote C51 SAMPLE.C NOINTPROMOTE 下面的示例: stmt lvl source 1 char c; 2 unsigned char c1,c2; 3 int i; 4 5 main () { 6 1 if (c == 0xff) c = 0; /* never true! */ 7 1 if (c == -1) c = 1; /* works */ 8 1 i = c + 5; 9 1 if (c1 < c2 +4) c1 = 0; 10 1 } 说明使用 INTPROMOTE 和 NOINTPROMOTE 伪指令生成的代码:
|