- 博客(7)
- 收藏
- 关注
转载 container_of的理解
问题:如何通过结构中的某个变量获取结构本身的指针???关于container_of见kernel.h中:/*** container_of - cast a member of a structure out to the containing structure* @ptr: the pointer to the member.* @type: the t
2014-05-23 15:18:50
343
转载 volatile与const
这是ST库里面的宏定义,定义如下:#define __I volatile const /*!< defines 'read only' permissions */#define __O volatile /*!#define __IO volatile
2014-05-18 18:36:12
386
转载 C语言 # 与 ## 的妙用
一、一般用法我们使用#把宏参数变为一个字符串,用##把两个宏参数贴合在一起.用法:普通浏览复制代码#include#includeusing namespace std;#define STR(s) #s#define CONS(a,b) int(a
2014-05-17 21:12:45
709
转载 关于宏和typedef类型定义的比较
typedef用来声明一个别名,typedef后面的语法,是一个声明。本来笔者以为这里不会产生什么误解的,但结果却出乎意料,产生误解的人不在少数。罪魁祸首又是那些害人的教材。在这些教材中介绍typedef的时候通常会写出如下形式: typedef int PARA; 这种形式跟#define int PARA几乎一样,如前面几章所述,这些教材的宗旨是由浅入深,但实际做出来的行为却是以偏盖全。的确,
2014-05-13 19:23:07
558
原创 嵌入式开发代码中的extern "C" {的作用
1、在好多程序中我们会遇到下面代码段#ifdef __cplusplus extern "C" { #endif//c语法代码段#ifdef __cplusplus } #endif //首先应该知道,__cplusplus是CPP中的自定义宏,则表示这是一段cpp的代码,编译器按c++的方式编
2014-04-22 10:16:12
947
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人