
C语言
文章平均质量分 66
ldzq_sue
这个作者很懒,什么都没留下…
展开
-
setjmp和longjmp
setjmp 和 longjmp 在C标准库<setjmp.h>中setjmp( jmp_buf j)必须首先被调用。它表示“使用变量 j 记录现在的位置。函数返回 0 ”。longjmp( jmp_buf j, int i)可以接着被调用。它表示“回到 j 所记录的位置,让它看上去像是从原先的 setjmp()函数返回一样,但函数返回 i,使代码能够知道它实际上是用过 longjmp...原创 2018-05-23 17:18:41 · 2938 阅读 · 2 评论 -
GNU C typeof
typeof 是 GNU C 标准里特有的扩展,标准的 ISO C 并没有这个关键字,所以在编译的时候不能加任何 ISO 的 C 标准选项,否则会报错。使用时加入-std=gnu90 即 GNU 的标准即可。typeof的作用类似与sizeof,区别在于sizeof是得到参数的大小而typeof则是推导出参数的类型。typeof的参数可以是两种形式:表达式或类型。 如:typeof(int *) ...原创 2018-05-23 17:20:12 · 323 阅读 · 0 评论 -
linux内核常用宏container_of
linux内核常用宏container_of定义如下:/* linux-2.6.38.8/include/linux/kernel.h * * container_of - cast a member of a structure out to the containing structure * @ptr: the pointer to the member. * @type: the...原创 2018-05-23 17:20:45 · 281 阅读 · 0 评论