Open lm-kasuga opened 4 years ago
The variable len is int, but %u is used. This may cause UB(but the compiler doesn't say any errors or warnings. ref. https://stackoverflow.com/questions/11303784/why-doesnt-gcc-wformat-warn-about-printf-d-on-an-unsigned-int) We should use %d instead, or change the type of len to unsigned int. Using other C++ STL (like std::stringstream) is also good, I think. https://github.com/blue-oil/blueoil/blob/3510e3f12f4f4ef7f5c9b0c0c784e1cdc2a74a38/blueoil/converter/templates/include/npy.hpp#L104
len
int
%u
%d
unsigned int
std::stringstream
The variable
len
isint
, but%u
is used. This may cause UB(but the compiler doesn't say any errors or warnings. ref. https://stackoverflow.com/questions/11303784/why-doesnt-gcc-wformat-warn-about-printf-d-on-an-unsigned-int) We should use%d
instead, or change the type oflen
tounsigned int
. Using other C++ STL (likestd::stringstream
) is also good, I think. https://github.com/blue-oil/blueoil/blob/3510e3f12f4f4ef7f5c9b0c0c784e1cdc2a74a38/blueoil/converter/templates/include/npy.hpp#L104