The most seen assertion are during runtime, but this one is at compile time, to give the error more quickly..

I do not quite understand why need this kind of check.. The following is code from OVS..

#define BUILD_ASSERT(EXPR) \
  typedef char AssertOnCompileFailed[(EXPR)?:-] #define BUILD_ASSERT_DECL(EXPR) BUILD_ASSERT(EXPR)
typedef struct _NlMsgErr {
  INT error;
  NL_MSG_HDR nlMsg;
} NL_MSG_ERR, *PNL_MSG_ERR;
BUILD_ASSERT_DECL(sizeof(NL_MSG_ERR)==);

I think maybe the typedef of struct is constructed at compile time, so assert at compile time is not a bad idea..

Compile Time Assertion..的更多相关文章

  1. linux环境c++开发:ubuntu12.04使用llvm3.4.2

    什么是 clang/llvm/libc++[1] clang 是最近几年(在大财主苹果的支持下)发展得非常好的 C 家族语言 (包括C/C++/Obj-C/Obj-C++) 编译器前端,所谓前端,就是 ...

  2. CentOS 7 编译安装clang+llvm

    天在CentOS上将最新版本的LLVM套件(LLVM,Clang和Libc++)编译安装好了,中间遇到了不少问题.虽然已经有很多博客介绍如何编译安装LLVM了,但是根据我自己亲身体验的情况来看,还是有 ...

  3. 代码还原,IDA中使用的宏

    在IDA7.0中的定义文件拷贝的. 如果想使用,直接去IDA的plugins插件目录下.包含它的 **defs.h"" 如下: /* This file contains defi ...

  4. Angular源码分析之$compile

    @(Angular) $compile,在Angular中即"编译"服务,它涉及到Angular应用的"编译"和"链接"两个阶段,根据从DO ...

  5. Compile FreeCAD on Windows

    Compile FreeCAD on Windows eryar@163.com 1.Introduction FreeCAD是一个参数化的三维造型软件,主要用于任意大小的实际模型的设计.参数化的建模 ...

  6. maven 加入json-lib.jar 报错 Missing artifact net.sf.json-lib:json-lib:jar:2.4:compile

    <dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</art ...

  7. $compile

    <html ng-app="compile"> <head> <script src="http://apps.bdimg.com/libs ...

  8. 关于The C compiler "arm-none-eabi-gcc" is not able to compile a simple test program. 的错误自省...

    在 GCC ARM Embedded https://launchpad.net/gcc-arm-embedded/ 上面下载了个arm-none-eabi-gcc 用cmake 编译时 #指定C交叉 ...

  9. My first makefile to compile multiple C files

    I have three files to compile: main.c, func.c,  func.h The steps: 1   main.c   to   main.o 2   func. ...

随机推荐

  1. C#中的DataSet添加DataTable问题

    最近在使用DataTable来给前台控件绑定数据,开始时查了网上的一些给DataSet添加DataTable时需要注意的地方,一般都要添加表名并且使用DataTable.Copy()方法,否则会报错, ...

  2. label 不同颜色

    label  不同颜色 UILabel* noteLabel = [[UILabel alloc] init]; noteLabel.frame = CGRectMake(60, 100, 200, ...

  3. Framebuffer原理、使用、测试系列文章,非常好的资料,大家一起学习

    转载:http://blog.csdn.net/tju355/article/details/6881372 *一.FrameBuffer的原理* FrameBuffer 是出现在 2.2.xx 内核 ...

  4. 导入libxml.dylib用Google的GDataXML解析XML数据

    1.用Google的GDataXML来解析XML数据,导入libxml.dylib 2.导入libxml.dylib的操作实现,一开始自己总是找不到libxml.dylib文件. 选择其他文件,到路径 ...

  5. mac关机快捷键

    1.Ctrl + 关机:弹出关机提示 2.Ctrl + Option + 关机 : 正常关机快捷键 3.Command + Option + 关机 :进入休眠状态 4.Ctrl + Command + ...

  6. 返回变量的类型VarType函数

    'vbEmpty 0 Empty(未初始化)'vbNull 1 Null(无有效数据)'vbInteger 2 整数'vbLong 3 长整数'vbSingle 4 单精度浮点数'vbDouble 5 ...

  7. drupal7 sql接口笔记

    1.查询: execute() ->fetch():从结果集中取出一行作为一个对象 execute() ->fetchField():获取单个值 execute() ->fetchA ...

  8. JAVA中方法的定义与使用(课堂学习归纳)

    组合数,百度词条是这样解释的:从m个不同元素中取出n(n≤m)个元素的所有组合的个数,叫做从m个不同元素中取出n个元素的组合数(Combination) 对于计算组合数,需要一定的工作量,计算机可以很 ...

  9. C#使用LitJson解析JSON(转)

    JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式.它基于JavaScript(Standard ECMA-262 3rd Edition - Decembe ...

  10. slf4j 之logback日志之sl4j架构【二】

    一.整体介绍 介绍: The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for v ...