重构一个库的过程

2018-03-08  本文已影响0人  ww4u

为什么需要重构

怎样实现

格式化

去掉全局变量

审核库中对于资源的申请和释放

double** J = new double*[6];
double localRads[ angleCount ];

重新封装API

res.P1 = tempP[j][0];
        res.P2 = tempP[j][1];
        res.P3 = tempP[j][2];
        res.P4 = tempP[j][3];
        res.V1 = tempV[j][0];
        res.V2 = tempV[j][1];
        res.V3 = tempV[j][2];
struct xxxXXX
{
    union {
        struct {
        double x[4];
        double xx[4];
        double xxx;
        };

        double datas;
    };
};
namespace xxx
{
#include "outlib.cpp"
}

统一错误返回

增加配置项

整理代码结构

添加注释

测试

上一篇 下一篇

猜你喜欢

热点阅读