`
yaojingguo
  • 浏览: 202396 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

The New C: X Macros (memo)

 
阅读更多

The code:

#include <stdio.h>

#define COLOR_TABLE \
X(red, "red")       \
X(green, "green")   \
X(blue, "blue")

#define X(a, b) a,
enum COLOR {
  COLOR_TABLE
};
#undef X

#define X(a, b) b,
char *color_name[] = {
  COLOR_TABLE
};
#undef X

int main() {
  enum COLOR c = red;
  printf("c=%s\n", color_name[c]);
  return 0;
}
 

Refer to http://www.drdobbs.com/cpp/184401387

分享到:
评论

相关推荐

    UNIX in a Nutshell 3rd ed 1999

    Chapter 5: The C Shell Part II: Text Editing and Processing Chapter 6: Pattern Matching Chapter 7: The Emacs Editor Chapter 8: The vi Editor Chapter 9: The ex Editor Chapter 10: The sed Editor ...

    Unix in a nutshell

    Chapter 5: The C Shell Chapter 6: Pattern Matching Chapter 7: The Emacs Editor Chapter 8: The Vi Editor Chapter 9: The Ex Editor Chapter 10: The Sed Editor Chapter 11: The Awk Scripting Language ...

    spire-macros_2.12-0.13.0-API文档-中文版.zip

    赠送jar包:spire-macros_2.12-0.13.0.jar; 赠送原API文档:spire-macros_2.12-0.13.0-javadoc.jar; 赠送源代码:spire-macros_2.12-0.13.0-sources.jar; 赠送Maven依赖信息文件:spire-macros_2.12-0.13.0.pom;...

    breeze-macros_2.12-0.13.2-API文档-中英对照版.zip

    赠送jar包:breeze-macros_2.12-0.13.2.jar; 赠送原API文档:breeze-macros_2.12-0.13.2-javadoc.jar; 赠送源代码:breeze-macros_2.12-0.13.2-sources.jar; 赠送Maven依赖信息文件:breeze-macros_2.12-0.13.2....

    breeze-macros_2.12-0.13.2-API文档-中文版.zip

    赠送jar包:breeze-macros_2.12-0.13.2.jar; 赠送原API文档:breeze-macros_2.12-0.13.2-javadoc.jar; 赠送源代码:breeze-macros_2.12-0.13.2-sources.jar; 包含翻译后的API文档:breeze-macros_2.12-0.13.2-...

    spire-macros_2.12-0.13.0-API文档-中英对照版.zip

    赠送jar包:spire-macros_2.12-0.13.0.jar; 赠送原API文档:spire-macros_2.12-0.13.0-javadoc.jar; 赠送源代码:spire-macros_2.12-0.13.0-sources.jar; 赠送Maven依赖信息文件:spire-macros_2.12-0.13.0.pom;...

    hooks.macro:BaBabel Macros用于自动React Hooks记忆无效化

    Babel Macros for React Hooks会自动使备忘录无效。 特征 提取所有使用的引用,并将它们添加到输入数组。 偏重于性能的严格正确性,但使用安全的优化方法: 跳过常量和无用的记忆键; 遍历所有调用或引用的函数...

    power:Power为您提供了宏,这些宏可以通过抽象出多余的语法来简化您的生活

    力量 Power为您提供了宏,这些宏可以通过抽象掉多余的语法来简化您的生活。... # Inculde the macros module include Power :: Macros # Import the class access in this class import First :: Second

    Macros.inc

    Macros.inc Macros.inc Macros.inc

    Fluent UDF Manual

    Information in this manual is presented in the following chapters: • Chapter 1: Overview • Chapter 2: DEFINE Macros • Chapter 3: Additional Macros for Writing UDFs • Chapter 4: Interpreting UDFs ...

    macros:FVTT社区宏-:memo:贡献宏或将其作为模块下载! :memo:

    https://raw.githubusercontent.com/foundry-vtt-community/macros/master/module.json GM进入“世界设置”选项卡中的“管理模块”选项菜单,然后启用“ Foundry社区宏”模块。 此模块将所有社区宏添加为称为FVTT...

    Microsoft Excel 2019 VBA and Macros

    and automate the best new features in Excel 2019 and Excel in Office 365. You’ll find simple, step-by-step instructions, real-world case studies, and 50 workbooks packed with examples and complete, ...

    Mastering Clojure Macros(Pragmatic,2014)

    Level up your skills by taking advantage of Clojure's powerful macro system. Macros make hard things possible and ... And you'll use macros to remove unnecessary code and build new language features.

    Writing Excel Macros with VBA 2nd Edition

    writing VBA macros and programs, and will show you how to get more power at the programming level: focusing on programming languages, the Visual Basic Editor, handling code, and the Excel object model...

    VBA and Macros: Microsoft Excel 2010 PDF

    I teach a course in India on Financial Modeling Using Excel to the MBA students in India and I use macros a lot in my models. I was looking for a good book on this subject which I can refer to for ...

    macros:常用C宏的集合

    #macros.h 有用的 C #宏 这是我在网上找到的常用 C 宏的集合,也是我朋友推荐的。 为什么这很棒 使用 C 宏,我们可以使用许多有用的功能扩展 C。 例如,我们可以创建像 foreach 这样的循环,这在处理数组时非常有用...

    Access 2003 Macros

    The Access 2003 Macros e-book was designed to supplement advanced software training courses, but will be useful for any user with advanced knowledge of the Access program. The guide provides step by ...

    Microsoft.Excel.2019.VBA.and.Macros

    We can help you reduce the learning curve so that you can write your own VBA macros and put an end to the burden of generating reports manually. Reducing the learning curve This Introduction ...

    The C Cheat Sheet - An Introduction to Programming in C

    比较简短的C语言教程,英文资料 1.0 Introduction 1.1 The main() Function 1.2 Include Files 1.3 Whitespace 1.4 The Preprocessor 1.4.1 The #define Directive 1.4.2 Comments 1.4.3 The #include Directive ...

    Laravel开发-macros

    Laravel开发-macros Laravel套装

Global site tag (gtag.js) - Google Analytics