84669 personnes étudient
152542 personnes étudient
20005 personnes étudient
5487 personnes étudient
7821 personnes étudient
359900 personnes étudient
3350 personnes étudient
180660 personnes étudient
48569 personnes étudient
18603 personnes étudient
40936 personnes étudient
1549 personnes étudient
1183 personnes étudient
32909 personnes étudient
要求: 1. 只对指定的函数生效 2. 最好的编译器无关的(我用的是g++,如果不能实现编译器无关的,能让g++心满意足也足够了) 3. 不带来额外的运行时消耗 4. 给人带来的惊讶越小越好。(比如 signal = 0这样的做法就不推荐了)
signal = 0
求各种可行的有趣的quick but not dirty的解决方案。
走同样的路,发现不同的人生
如果可能,请务必用正常方法消除 warning,真的多余就去掉吧
方法一:
void foo(int a) { (void)a; // ... }
方法二:
#ifdef __GNUC__ # define UNUSED(x) UNUSED_ ## x __attribute__((__unused__)) #else # define UNUSED(x) UNUSED_ ## x #endif void foo(int UNUSED(a)) { // ... }
参考:http://stackoverflow.com/a/12891181
void f(int) { // ... }
如果可能,请务必用正常方法消除 warning,真的多余就去掉吧
方法一:
方法二:
参考:http://stackoverflow.com/a/12891181