⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bug608752.c

📁 sdcc是为51等小型嵌入式cpu设计的c语言编译器支持数种不同类型的cpu
💻 C
字号:
/* OpAssign tests
 */
#include <testfwk.h>

#ifdef SDCC
#include <sdcc-lib.h>
#else
#define _STATMEM
#endif

typedef struct
{
  char a;
  char n;
} item_type;

item_type t;


_STATMEM item_type* get_next_item(void)
{
  /* have a side effect */
  t.n++;

  /* keep things easy, not implementing a list.
     Using a true list would break things
     even more pointedly:
     a) reading beyond end of the list and
     b) intermixing list members */
  return &t;
}


void
testOpAssign(void)
{
  t.a = 0;
  t.n = 0;

  /* get_next_item() should be called only once */
  get_next_item()->a |= 42;

  ASSERT (t.a == 42);
  ASSERT (t.n == 1);
}

⌨️ 快捷键说明

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