it confused me. the code is like below, the format string type is same as argument type, but still report this error.
%lu in format string (no. 3) requires 'unsigned long' but the argument type is 'std::size_t {aka unsigned long}
snprintf((char *)ev.data, MaxLogLength, "%6d:%6d:%5lu;%5s;%-16s;%s", \ getpid(), gettid(), mq ? mq->getnumber() : 0, level, from, msgstr.c_str());
the definition of function of getnumber() is below, my PC OS is 64 bit Debian9.
std::size_t GCEventContext_MQ::getnumber() { return m_mq->get_num_msg(); }
The portable format specifier for size_t is %zu.
size_t
%zu
Thank you very much
Log in to post a comment.
it confused me.
the code is like below, the format string type is same as argument type, but still report this error.
%lu in format string (no. 3) requires 'unsigned long' but the argument type is 'std::size_t {aka unsigned long}
the definition of function of getnumber() is below, my PC OS is 64 bit Debian9.
The portable format specifier for
size_t
is%zu
.Thank you very much