提交 3d01c60e 编写于 作者: Y Yu Yang

Stash

上级 8aefc304
...@@ -24,6 +24,13 @@ namespace paddle { ...@@ -24,6 +24,13 @@ namespace paddle {
* Status is Paddle error code. It only contain a std::string as error message. * Status is Paddle error code. It only contain a std::string as error message.
* Although Status inherits the std::exception, but do not throw it except you * Although Status inherits the std::exception, but do not throw it except you
* know what you are doing. * know what you are doing.
*
*
* There are two styles to return status in Paddle.
*
* 1. Return Status
*
*
*/ */
class Status final : public std::exception { class Status final : public std::exception {
public: public:
...@@ -52,7 +59,7 @@ public: ...@@ -52,7 +59,7 @@ public:
*/ */
template <typename... ARGS> template <typename... ARGS>
inline void setByPrintf(const char* fmt, ARGS... args) noexcept { inline void setByPrintf(const char* fmt, ARGS... args) noexcept {
constexpr size_t kBufferSize = 4096; constexpr size_t kBufferSize = 1024; // 1KB buffer
char buffer[kBufferSize]; char buffer[kBufferSize];
snprintf(buffer, kBufferSize, fmt, args...); snprintf(buffer, kBufferSize, fmt, args...);
errMsg_.reset(new std::string(buffer)); errMsg_.reset(new std::string(buffer));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册