bug-221100.c

来自「Small Device C Compiler 面向Inter8051」· C语言 代码 · 共 39 行

C
39
字号
/* bug-221100.c   If test_index is char, loses high bit when indexes table    workaround is to use [(unsigned int) test_index]  */#include <testfwk.h>#ifdef __mcs51xdata#endifstatic unsigned inttestArray[130];static unsigned int test_int ; static unsigned char test_index ; static void fetch(void) {   test_int = testArray [test_index] ; } static voidtestUnsignedCharIndex(void){  int i;  for (i = 0; i < 130; i++) {    testArray[i] = i;  }  test_index = 5;  fetch();  ASSERT(test_int == 5);  test_index = 129;  fetch();  ASSERT(test_int == 129);}

⌨️ 快捷键说明

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