今天雄哥教小伙伴们怎么写代码,让其他程序员看不懂,对,小伙伴们听错,今天就是教大家怎么写出让同事无法维护的代码,保证不会被打死。
01 程序命名
02 伪装欺诈
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 ];
}
#define local_var xy
_z // local_var OK
#define xxx global_var // in file std.h
#define xy_z xxx // in file ..othersubstd.h
#define local_var xy_z // in file ..codestdinst.h
#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
03 文档和注释
04 程序设计
05 混乱你的代码
06 测试
07 其它
总之,我们的口号是——Write Everywhere, Read Nowhere