当前位置:网站首页>Record development issues
Record development issues
2022-07-28 16:53:00 【be faithful to one 's husband unto death】
scene :
There is a problem in writing code : For example, we need to do a login operation , Then, before this login operation, several confirmation interactions should be carried out , Several interactions must be successful , The structure of the code I wrote is as follows
bool step1();
bool step2();
bool step3();
bool step4();
bool step5();
bool step6();
bool login()
{
ret = step1();
if(!ret)
{
return ret;
}
ret = step2();
if(!ret)
{
return ret;
}
ret = step3();
if(!ret)
{
return ret;
}
ret = step4();
if(!ret)
{
return ret;
}
ret = step5();
if(!ret)
{
return ret;
}
ret = step6();
if(!ret)
{
return ret;
}
return true;
}This code structure makes people look disgusting , How to optimize the ?
bool step1();
bool step2();
bool step3();
bool step4();
bool step5();
bool step6();
bool login()
{
ret1 = step1();
ret2 = step2();
ret3 = step3();
ret4 = step4();
ret5 = step5();
ret6 = step6();
return ret1 & ret2 & ret3 & ret4 & ret5 & ret6;
}Is this optimization OK ? To express doubt
边栏推荐
- leetcode9. 回文数
- Sort 2 bubble sort and quick sort (recursive and non recursive explanation)
- 微软100题-天天做-第16题
- Understanding of asmlinkage
- 每一个账号对应所有密码,再每一个密码对应所有账号暴力破解代码怎么写?...
- IM即时通讯开发优化提升连接成功率、速度等
- Tcp/ip related
- Ansa secondary development - two methods of drawing the middle surface
- Optimization of network request success rate in IM instant messaging software development
- How to set ticdc synchronization data to only synchronize the specified library?
猜你喜欢

USB产品(FX3、CCG3PA)的调试方法

排序3-选择排序与归并排序(递归实现+非递归实现)

Interesting kotlin 0x06:list minus list

Debugging methods of USB products (fx3, ccg3pa)

Each account corresponds to all passwords, and then each password corresponds to all accounts. How to write the brute force cracking code

队列的介绍与实现(详解)

有趣的 Kotlin 0x09:Extensions are resolved statically

Sort 4-heap sort and massive TOPK problem

IM即时通讯开发优化提升连接成功率、速度等

Configure HyperMesh secondary development environment on vs Code
随机推荐
Applet: get element node information
Mysql与Oracle的13点区别
排序3-选择排序与归并排序(递归实现+非递归实现)
[pointer internal skill cultivation] character pointer + pointer array + array pointer + pointer parameter (I)
【从零开始学习SLAM】将坐标系变换关系发布到 topic tf
信号屏蔽与处理
2021-04-02
Splash (rendering JS service) introduction installation
给定正整数N、M,均介于1~10 ^ 9之间,N <= M,找出两者之间(含N、M)的位数为偶数的数有多少个
Design direction of daily development plan
leetcode9. 回文数
PHP calculate coordinate distance
微软100题-天天做-第11题
Debugging methods of USB products (fx3, ccg3pa)
“蔚来杯“2022牛客暑期多校训练营3 A.Ancestor LCA+暴力计数
排序1-插入排序与希尔排序
mysql cdc 如果binlog日志文件不全,全量阶段能读到所有数据吗
Simple addition, deletion, modification and query of commodity information
栈的介绍与实现(详解)
Call DLL file without source code