判断程序员能力,仅一项和代码有关

你见过哪些操蛋的代码?

NO.1

#define TRUE FALSE 

NO.2


NO.3


#define if( if(! 

NO.4


#define if(x) if(!(x)) 

NO.5


#define if while 

NO.6


if(m_doc->isModified() == true)
{
    for(int i = 0;i<100;i++)
    {
        save();//上次测试提了个bug说保存数据失败,这次保存100次,肯定没有问题了。
    }
} 

NO.7


public enum ColorType
{
Green, // 绿色
Hong, // 红色
}

//......
this.curColortype= ColorType.Hong; 

NO.8


enum FiveLine
{
  Gold,
  Wood,
  Water,
  Fire,
  Earth,
}; 

NO.9


(a != b) ? b : a 

NO.10


#include

void duff_memcpy( char* to, char* from, size_t count ) {
    size_t n = (count+7)/8;
    switch( count%8 ) {
    case 0: do{ *to++ = *from++;
    case 7:     *to++ = *from++;
    case 6:     *to++ = *from++;
    case 5:     *to++ = *from++;
    case 4:     *to++ = *from++;
    case 3:     *to++ = *from++;
    case 2:     *to++ = *from++;
    case 1:     *to++ = *from++;
            }while(--n>0);
    }
}

void main(void) {
    char *s1 = "nihao,woshi helloworld";
    char *s2;

    s2 = (char *)malloc(strlen(s1));

    duff_memcpy(s2,s1,strlen(s1));

    printf("%s",s2);

    free(s2);
} 

NO.11

没见过这样的吧,加个网址在里面,但是编译运行正常的哦


#include
using namespace std;

int main(int argc, char *argv[]) {
    int i = 10;

http://www.stackoverflow.com
    printf("Hello,World");
    getchar();
    return 1;
}

此文来源于网络 若有侵权 请联系晓雯微信:Pingwen20 删除

你可能感兴趣的:(判断程序员能力,仅一项和代码有关)