本文展示的代码片段来自知乎的同名问答贴,本文列举了一些反面例子,切勿模仿,就当轻松一刻了吧~
题主的补充
String result;
......
return result.toString();
这种算吗?大家尽情吐槽吧!
Cyandev 的分享
if (m_doc->isModified() ==
true)
{
for (
int i =
0; i <
100; i )
{
save();
//Save the document for 100 times to ensure it has been saved successfully.
}
}
不知谁写的,总之我都看哭了~
侯杰 的分享
enum FiveLine
{
Gold,
Wood,
Water,
Fire,
Earth,
};
看
枚举名字不知道五行(hang)是什么鬼,看了枚举内容恍然大悟,原来是五行(xing)……
李旭东 的吐槽
class=
"div1">
class=
"div2">
class=
"div3">
class=
"div4">
………
class=
"div27">
class=
"div28">
…………
class=
"div396">
class=
"div397">
…………
class=
"giveMeAFuckingClassName">
白砂糖 的分享
// 以下所有left代表右
// 以下所有right代表左
Kun Andy 的分享
public enum ColorType
{
Green,
// 绿色
Hong,
// 红色
}
//......
this.curColortype= ColorType.Hong;
......
毫无违和感,英语和汉语的激烈碰撞,一时愣是没读懂代码,“Hong”为何物,你看注释才恍然大悟,真是犀利!
可能是绿的拼音(lv) 有点像等级,所以为了防止歧义,用了Green!赞一个!
程序员很可爱,我爱程序猿大家庭!
这些蕴含智慧的
代码是礼物也是惊喜!
可以帮你拉这么多zan!感谢!
真爱身边的程序员!
孙传武 的分享
有次看一项目源码,注释里有个warning。
// warning:
Do not make
any changes here.
// I got confused why it can run successfully.
// PLEASE
Do not make
any changes
before you figure it out.
绅士提督不笑船 的分享
变量名:
class UplaodDuiLie
// 上传队列
// Uplaod 非手误,完全原文。
// 为什么你们只吐槽 typo 而不吐槽中英文混合呢。。
myd7349 的分享
从长度上来说,完爆楼上各位的。一起来感受下:
if(m_Str2.Find(
"'")>=
0)
{
AfxMessageBox(
"您输入的包含非法字符");
m_Str2=
"";
UpdateData(
FALSE);
return;
}
if(m_Str2.Find(
':')>=
0)
{
AfxMessageBox(
"您输入的包含非法字符");
m_Str2=
"";
UpdateData(
FALSE);
return;
}
if(m_Str2.Find(
'/')>=
0)
{
AfxMessageBox(
"您输入的包含非法字符");
m_Str2=
"";
UpdateData(
FALSE);
return;
}
if(m_Str2.Find(
'!')>=
0)
{
AfxMessageBox(
"您输入的包含非法字符");
m_Str2=
"";
UpdateData(
FALSE);
return;
}
if(m_Str2.Find(
'@')>=
0)
{
AfxMessageBox(
"您输入的包含非法字符");
m_Str2=
"";
UpdateData(
FALSE);
return;
}
if(m_Str2.Find(
'#')>=
0)
{
AfxMessageBox(
"您输入的包含非法字符");
m_Str2=
"";
UpdateData(
FALSE);
return;
}
if(m_Str2.Find(
'$')>=
0)
{
AfxMessageBox(
"您输入的包含非法字符");
m_Str2=
"";
UpdateData(
FALSE);
return;
}
if(m_Str2.Find(
'%')>=
0)
{
AfxMessageBox(
"您输入的包含非法字符");
m_Str2=
"";
UpdateData(
FALSE);
return;
}
if(m_Str2.Find(
'
本站声明: 本文章由作者或相关机构授权发布,目的在于传递更多信息,并不代表本站赞同其观点,本站亦不保证或承诺内容真实性等。需要转载请联系该专栏作者,如若文章内容侵犯您的权益,请及时联系本站删除。