PaddlePaddle / Mobile

Embedded and Mobile Deployment
Apache License 2.0
71 stars 29 forks source link

Cannot use |= to paddle_error #56

Open Xreki opened 6 years ago

Xreki commented 6 years ago

We use |= to paddle_error in our benchmark. https://github.com/PaddlePaddle/Mobile/blob/6b68be7a97cb66885f47816fd360b41896fc1147/benchmark/tool/C/inference.cc#L21-L24

However, the definition of paddle_error is: https://github.com/PaddlePaddle/Paddle/blob/c8d4efb20eecab5a2edd55ccf923dac78afc6d78/paddle/capi/error.h#L23-L30

typedef enum {
  kPD_NO_ERROR = 0,
  kPD_NULLPTR = 1,
  kPD_OUT_OF_RANGE = 2,
  kPD_PROTOBUF_ERROR = 3,
  kPD_NOT_SUPPORTED = 4,
  kPD_UNDEFINED_ERROR = -1,
} paddle_error;

The different bit of different error may be the same. If we use |= to two variables of paddle_error, we may lose the error information.

Also, we need to print the error information, or it will be difficult for users to debug, like in #48 .