Compile Time Assertion..
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..的更多相关文章
- linux环境c++开发:ubuntu12.04使用llvm3.4.2
什么是 clang/llvm/libc++[1] clang 是最近几年(在大财主苹果的支持下)发展得非常好的 C 家族语言 (包括C/C++/Obj-C/Obj-C++) 编译器前端,所谓前端,就是 ...
- CentOS 7 编译安装clang+llvm
天在CentOS上将最新版本的LLVM套件(LLVM,Clang和Libc++)编译安装好了,中间遇到了不少问题.虽然已经有很多博客介绍如何编译安装LLVM了,但是根据我自己亲身体验的情况来看,还是有 ...
- 代码还原,IDA中使用的宏
在IDA7.0中的定义文件拷贝的. 如果想使用,直接去IDA的plugins插件目录下.包含它的 **defs.h"" 如下: /* This file contains defi ...
- Angular源码分析之$compile
@(Angular) $compile,在Angular中即"编译"服务,它涉及到Angular应用的"编译"和"链接"两个阶段,根据从DO ...
- Compile FreeCAD on Windows
Compile FreeCAD on Windows eryar@163.com 1.Introduction FreeCAD是一个参数化的三维造型软件,主要用于任意大小的实际模型的设计.参数化的建模 ...
- 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 ...
- $compile
<html ng-app="compile"> <head> <script src="http://apps.bdimg.com/libs ...
- 关于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交叉 ...
- 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. ...
随机推荐
- stm32
GPIO NVIC TIME USART ONE WIRE IIC SPI PWM ADC LCD XPT UCOSiii移植 定时器 蓝牙 陀螺仪
- linux基础-安装篇
linux现在的版本已经升级到7.x的版本了,现在虽然企业还是使用6.x的版本,但是未来的趋势肯定是往7的方向发展的,很多的培训机构或者一些学校的课程也都更新的7的版本进行教学,下面的安装实例就是以7 ...
- json_encode不编码中文字符的方式
json_encode($array,JSON_UNESCAPED_UNICODE);
- Oracle 字符集小结(遇到一例子:查询结果列标题为汉字,但是显示为‘?')
问题处理方式: 查询:select userenv('language') from dual; 对比电脑环境变量NLS_LANG的值与查询结果是否一致,如果不一致,修改电脑环境变量NLS_LANG ...
- php专业面试总结
PHP专业面试题汇总 一.PHP基础: 2 二.数据库部分 5 三.面向对象部分 9 四.ThinkPHP部分 12 五.smarty模板引擎 16 六.二次开发系统(DEDE.ecshop): 18 ...
- android从assets读取文件的方法
因为开发需要,经常要从工程的assets文件夹里面读取文件,现在贴一个方法以作记录: private void getFromAssets(String fileName, ArrayList< ...
- LogFactory缺包异常
抛出异常: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/loggin ...
- sql 关于dblink和多条update、insert事务回滚写法
在存储过程的编写中难免会遇到调用同库他人的proc和跨库调用proc,还有一个proc中有多条对多表进行写入和修改的语句.那么就会用到tran. 如果我们在不写try的情况下就要对每个insert,u ...
- Valid Number--LeetCode
class Solution { public: bool isNumber(string s) { if(s == " ") return false; ; ; while(s[ ...
- CentOS6.3添加nginx系统服务详细说明
今天虚拟机上配了下服务器整理了个这个 nginx 服务 要注意 - 短横杠这个符号看看复制进去后有没有乱码,我之前就遇到这个问题,郁闷了好久才发现 提示:顶部的注释不要去除否则无法注册为系统服务, 关 ...