摘要:he gcc C compiler has a built-in directive that optimizes conditional branches as either very likely taken or very unlikely taken. The compiler uses t...
阅读全文
摘要:在GNU C中,宏可以接受可变数目的参数,就象函数一样可以把__VA_ARGS__看成是将...赋值给该宏//注意这里不能在函数中调用abc()#include #include #define ABC(...) printf(__VA_ARGS__)/*void abc(...){ //pr...
阅读全文
摘要:看了http://www.cnblogs.com/lixiaohui-ambition/archive/2012/08/21/2649052.html,所以自己写了几行代码测试了下#include int main(){ printf("date:%s",__DATE__); print...
阅读全文
摘要:如果tcp中没有上层协议,那么就是简单的数据包的传输,如果tcp中有上层协议,那么,当客户端把tcp包发给server的时候,server端的socket收到数据包后,从中分离出应用层协议,交给上层继续下面是一个tcp封装http的代码#include /* For socket functions...
阅读全文
摘要:#define typecheck(type,x) \ ({ type __dummy; \typeof(x) __dummy2; \ (void)(&__dummy == &__dummy2); \1; \ }) 看起来觉得没什么用的代码,其实是检查输入的参数x是不是类型type。检测的方法很巧...
阅读全文