要理解Linux中实现的双向循环链表("侵入式"链表),首先得弄明白宏container_of. 本文尝试从gcc的关键字typeof和宏offsetof入手,循序渐进地剖析宏container_of之实现原理. 1. typeof (from: https://en.wikipedia.org/wiki/Typeof) typeof is an operator provided by several programming languages to determine the da…
引述自http://c-programming.itags.org/q_c-programming-language_191518.html 源代码中的宏min中使用了 (void) (&_x == &_y); ( c89不支持typeof ) 有如下解释 Assuming (as the name "typeof" implies) that _x has the same type as x, and _y has the same type as y, c…
null和undefined是两种数据类型, 如果硬要区分的话. null是一种类型, 赋值变量为null型. 未定义的变量, 即为undefined. var a = null a // null var b b // undefined typeof(b) // "undefined" 标准解释 6.1.1 The Undefined Type The Undefined type has exactly one value, called undefined. Any varia…