#ifndef __int8_t_defined # define __int8_t_defined typedef signed char int8_t; typedef short int int16_t; typedef int int32_t; # if __WORDSIZE == 64 typedef long int int64_t; # else __extension__ typedef long long int int64_t; # endif #endif 节选自 /usr/include/stdint.h 我有点不明白的是,如果没有定义 __int8_t_defined 就定义...
本帖最后由 llslls_007 于 2010-05-21 17:14 编辑 //声明---------------- void debug(char *x); #define _debug(x) debug x #define _debug(x) debug(x) //--------------------- 两种宏都能用_debug("dfdfd"); 调用 debug(char * x) 函数 看GNU gcc cpp 手册 没看到有 #define _debug(x) debug x 如此定义宏函数的方式啊 ,哪位解释下?
做如下几点说明和介绍 1. 带参数的宏只完成简单字符替换,之前不做计算实参的工作,如下 #define SUM(x,y) x+y int a=3,b=2,c=1; int s; s=SUM(a+b,b)*SUM(c,b)+c; 结果应该是 s=a+b+b*c+b+c=10。 2. define中的特殊标识符 #define Conn(x,y) x##y #define ToChar(x) #@x #define ToString(x) #x int a=Conn(12,34); char b=ToChar(a); char c[]=ToString(a); 结果是 a=1234,c='a',c='1234'; 可以看...
#define vmdebug(x...) fprintf(stderr, "<%s>[%s](line:%d)\t",__FILE__,__FUNCTION__, __LINE__); fprintf(stderr, x); 运行: vmdebug("\n\n\n\n\n..............main() : GetVersion : %s ....................\n\n\n\n\n", GetVersion().c_str() ); 这句是. 请问是怎么对应的呢? thanks
c语言中经常提倡使用宏代替函数实现,来提高效率。过度或者大代码容量的define有没有什么负作用? (有c++中的inline联想到的),那位高手能解释一下c++的inline和c的define效率方面的异同点?
#include
如果我有一個 function 在kernel 叫做abc(x) 然後再a.c 裡面 define abc(x) __abc(x,y) void __abc(x,y) { xxx } EXPORT_SYMBOL(abc); 然後比方說b.c 會call abc() 然後這樣compiler會出現error 請問這樣寫是錯的嗎 ?
# include
请问下面的宏为什么要加上##,是变长参数的原因吗?[code]#define DEBUG(fmt, args...) fprintf(stderr, fmt, ##args)[/code]