bug-751703.c

来自「sdcc是为51等小型嵌入式cpu设计的c语言编译器支持数种不同类型的cpu」· C语言 代码 · 共 42 行

C
42
字号
/* bug-751703.c  Make sure extern within local scope binds to global  scope and is not optimized inappropriately. */#include "testfwk.h"int x = 1;int y = 2;int z = 0;static voidaddxy(void){  extern int x, y, z;  z = x+y;} static voidtimes10x(void){  unsigned char x;    z = 0;  for (x=0; x<10; x++)    {      extern int x; /* bind to the global x */      z += x;    }}static voidtestExternDeadCode(void){  ASSERT(z == 0);  addxy();  ASSERT(z == 3);  times10x();  ASSERT(z == 10);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?