C99 inline semantics are often misunderstood. The inline specifier serves two purposes:

First, as a compiler hint in case of static inline and extern inline declarations. Semantics remain unchanged if you remove the specifier.

Second, in case of raw inline (ie without static or extern) to provide an inline definition as an alternative to an external one, which has to be present in a different translation unit. Not providing the external one is undefined behaviour, which will normally manifest as linking failure.

阅读全文 »

写过C程序都知道,malloc了新的struct之后,经常跟着一大串的赋值。其实这些可以用一行漂亮的代码搞定。

先上代码:

1
2
3
4
#define new(type, ...) ({\
type* __t = (type*) malloc(sizeof(type));\
*__t = (type){__VA_ARGS__};\
__t; })
阅读全文 »

前段时间脑子一热就投了阿里巴巴的平台型产品经理。这段时间一直忙自己的事情,也没时间顾及这个面试。昨天晚上查了下资料,平台型产品经理是今年才有的职位,所以网上也没有什么资料,于是改改PPT就睡了(PPT是阿里面试前发邮件给大家要求做的作业)。

阅读全文 »

博主是一只大三渣本,计算机专业。三月份开学之后,各种实习机会纷纷开始,以死猪不怕开水烫的陆续投了五家业内顶尖的公司,拿到了4个Offer。能有这样的结局也出乎我预料,为了照顾以后的学弟学妹们,在此把我的经历和体会都记下来。

阅读全文 »
0%