代码风格
2014-08-03 22:09
85 查看
bool setYxCommand(const QString &sCommandCode, char value) //遥信
bool setYcCommand(const QString &sCommandCode, char value) //遥测
//下面的情况中,我曾经花费了一定的时间去找出错误:用错了函数!
f_oPlcProtocol->setYxCommand("save_bottle_manual", 0);
f_oPlcProtocol->setYxCommand("save_bottle_auto", 0);
f_oPlcProtocol->setYxCommand("save_bottle_force", 0);
f_oPlcProtocol->setYcCommand("get_bottle_manual", 0);
f_oPlcProtocol->setYxCommand("get_bottle_auto", 0);
f_oPlcProtocol->setYxCommand("get_bottle_force", 0);
//a better name
bool setYxinCmd(const QString &sCommandCode, char value) //遥信
bool setYceeCmd(const QString &sCommandCode, char value) //遥测
//////////////////////////////////////////////////////////////////////////////////1
bool *ok;
if(ok) * ok = true;
if(ok) *ok = true;
//上面第一个if, 一眼看过去还以为是(ok) * ok = true !!
//第二个if就是简明的最好范例。
//////////////////////////////////////////////////////////////////////////////////2
QString position = QString("Save to:(%s,%d,%d)").arg(x).arg(y).arg(u);
QString position = QString("Save to:(%1,%2,%3)").arg(x).arg(y).arg(u);
//QString中很容易出错的用法!
//////////////////////////////////////////////////////////////////////////////////3
bool setYcCommand(const QString &sCommandCode, char value) //遥测
//下面的情况中,我曾经花费了一定的时间去找出错误:用错了函数!
f_oPlcProtocol->setYxCommand("save_bottle_manual", 0);
f_oPlcProtocol->setYxCommand("save_bottle_auto", 0);
f_oPlcProtocol->setYxCommand("save_bottle_force", 0);
f_oPlcProtocol->setYcCommand("get_bottle_manual", 0);
f_oPlcProtocol->setYxCommand("get_bottle_auto", 0);
f_oPlcProtocol->setYxCommand("get_bottle_force", 0);
//a better name
bool setYxinCmd(const QString &sCommandCode, char value) //遥信
bool setYceeCmd(const QString &sCommandCode, char value) //遥测
//////////////////////////////////////////////////////////////////////////////////1
bool *ok;
if(ok) * ok = true;
if(ok) *ok = true;
//上面第一个if, 一眼看过去还以为是(ok) * ok = true !!
//第二个if就是简明的最好范例。
//////////////////////////////////////////////////////////////////////////////////2
QString position = QString("Save to:(%s,%d,%d)").arg(x).arg(y).arg(u);
QString position = QString("Save to:(%1,%2,%3)").arg(x).arg(y).arg(u);
//QString中很容易出错的用法!
//////////////////////////////////////////////////////////////////////////////////3
相关文章推荐
- XP风格的按钮代码
- 利用JavaScript和正则表达式进行丰富的日期判断(给其它项目组的代码,有比较好的编程风格和注释)
- 代码风格总结
- 程序员之路──关于代码风格
- XOOPS - theme主题风格 - 模板代码、区块设置与页面效果之间的对应关系
- 程序员写程序的代码风格
- c#代码风格——采用合适的方法访问DataTable里的记录
- 免代码编辑站点风格布局之自定义模板(一)
- 代码风格
- 代码风格-关于if语句
- c程序代码风格 版本1
- 代码的风格
- 代码风格还是很重要的
- 网站风格 代码
- samba unix风格的配置文件配置信息读取C代码.
- 编码的风格和如何设置调试代码
- 启用代码语法加亮CSS统一风格
- 超酷的XP风格的网页右键菜单特效代码
- ul+li及css制作韩国风格菜单代码
- PfxEditCtrl代码风格