enum5.c

来自「linux下编程用 编译软件」· C语言 代码 · 共 27 行

C
27
字号
// { dg-do run }// Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.// Contributed by Ben Elliston <bje@redhat.com>// PR 80: Packed enums use minimum required storage.extern "C" void abort();enum numbers { one, two, three } __attribute__ ((packed)) nums;enum colours { red = 1000, green, blue } __attribute__ ((packed)) cols;enum conditions { fine, rain, cloudy } __attribute__ ((packed)) forecast;intmain(){  if (sizeof (nums) != 1)    abort ();  if (sizeof (cols) != 2)    abort ();  if (sizeof (forecast) != 1)    abort ();  return 0;}

⌨️ 快捷键说明

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