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. 使用高通SDK开发AR应用

    具体AR是什么效果我这里就不说了,直接上过程: 1.去官网注册一个帐号https://developer.vuforia.com 2.下载SDK for Unity,并导入Unity 3.点击Deve ...

  2. iosAPP打包上架xcode中Archive提交成功以后,不提示构建版本问题

    最近在项目更新时遇到Archive提交到开发者中心成功后,一直不提示构建版本信息,可能导致的原因是由于ios10以后对于APP中调用手机相册或摄像头麦克风时需要配置plist文件,配置如下内容或许会解 ...

  3. wampserver使用过程中遇到的问题及相关配置

    wampserver集合了Apache+PHP+Mysql 下载地址:点这里 安装过程很方便,一直点下一步就行,中间会提示选择默认的浏览器及文件编辑器 起因: 使用过程中提示: In the http ...

  4. EF OrderBy(string propertyname), OrderByDescending(string propertyname) 按属性排序,扩展方法

    public static class LinqExtensions { private static PropertyInfo GetPropertyInfo(Type objType, strin ...

  5. ef code first 您没有所需权限

    在进行数据库更新操作时,update-database -force,反复提示没有改表或者没有所需权限,昨晚折腾了4个小时没有搞定,太晚了,今天Google了一下,这方面的错误,提到的都很少,在一篇文 ...

  6. c++ inline关键字的理解

    1. inline是实现修饰符,而非声明修饰符,所以应该用于实现部分的修饰(你也可以放置inline在声明,但是没有必要) 2. 所有中类中定义的函数都默认声明为inline函数,所有我们不用显示地去 ...

  7. 在线预览pdf、xlsx、docx、ppt等文档

    使用微软提供的Office Online平台只需要一个网址即可在线查看Xls,doc,PPT等文档 http://view.officeapps.live.com/op/view.aspx?src=要 ...

  8. 使用filter方法过滤集合元素

    文章转自https://my.oschina.net/nenusoul/blog/658238 Problem 你想要筛选出集合中的一些元素形成一个新的集合,这些元素都是满足你的筛选条件的. Solu ...

  9. django+celery+rabitmq

    django 项目中的设置(proj代表项目目录) proj settings.py CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672/' ...

  10. 使用PhotoShop

    详细请看:http://blog.sina.com.cn/s/blog_73dc36510101ahim.html