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. tomcat改端口的一些问题

    cmd运行netstat -anp查看端口使用情况,找到被占用端口的PID

  2. HDU 5839 Special Tetrahedron

    HDU 5839 Special Tetrahedron 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5839 Description Given n ...

  3. PHP操作Memcache基本函数

    Memcache模块提供了于Memcached方便的面向过程及面向对象的接口,Memcached是为了降低动态web应用从数据库加载数据而产生的一种常驻进程缓存产品.Memcache模块同时提供了一个 ...

  4. ajaxUploadFile在IE9等IE浏览器,上传变json下载的问题解决(SpringMVC + ajaxUploadFile)

    使用ajaxUploadFIle进行文件上传,在google中正常,但是IE中却变成了json文件下载.经过搜索和尝试,解决方案如下: 首先明确,该功能使用$.ajaxFileUpload而非ajax ...

  5. UILabel属性小解

    #import "ViewController.h" @interface ViewController () @end @implementation ViewControlle ...

  6. 关于设置CFileDialog的默认路径

    CFileDialog   d_File(FRUE, NULL,NULL,NULL,szFilter,FromHandle(m_hWnd)); // 如果写了下面这句那么每次打开都是这个设置的默认路径 ...

  7. Windows 查看端口占用

    查看 Windows 端口占用情况 在 Windows 命令行窗口下执行一下命令 查看所有端口占用情况 netstat -ano 查看特定端口的占用情况 netstat -aon|findstr &q ...

  8. linux环境vnc部署过程详解

    vnc服务端机器地址:10.165.38.68 vnc客户端机器地址:本机(windows机器) vnc客户端包:vnc_82537_82537.rar (百度云盘下载地址:http://pan.ba ...

  9. OSCache 使用

    引入OSCache的jar包 package com.sun.utils; import java.util.Date; import com.opensymphony.oscache.base.Ne ...

  10. POJ 2311 Cutting Game(SG+记忆化)

    题目链接 #include<iostream> #include<cstdio> #include<cstring> using namespace std; ][ ...