程序命名If builders built buildings the way programmers write programs, then the first woodpecker that came along would destroy civilization. (如果建筑师盖房子就像程序员写程序一样,那么,第一只到来的啄木鸟就能毁掉我们的文明)
~ Gerald Weinberg (born: 1933-10-27 age: 77) [url=http://www.geraldmweinberg.com/Site/Home.html]Weinberg’s Second Law
| 1 2 3 4 5 6 7 8 9 10 11 | for(j=0; j<array_len; j+ =8) { total += array[j+0 ]; total += array[j+1 ]; total += array[j+2 ]; /* Main body of total += array[j+3]; * loop is unrolled total += array[j+4]; * for greater speed. total += array[j+5]; */ total += array[j+6 ]; total += array[j+7 ]; } |
| 1 2 | #define local_var xy\ _z // local_var OK |
| 1 2 3 | #define xxx global_var // in file std.h #define xy_z xxx // in file ..\other\substd.h #define local_var xy_z // in file ..\codestd\inst.h |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #ifndef DONE #ifdef TWICE // put stuff here to declare 3rd time around void g(char* str); #define DONE #else // TWICE #ifdef ONCE // put stuff here to declare 2nd time around< void g(void* str); #define TWICE #else // ONCE // put stuff here to declare 1st time around void g(std::string str); #define ONCE #endif // ONCE #endif // TWICE #endif // DONE |
| 欢迎光临 数码鹭岛论坛 (http://www.clore.net/forum/) | Powered by Discuz! X3.2 |