Open
Description
描述问题
tbox目前的实现是这样的
tb_long_t tb_vsnprintf(tb_char_t* s, tb_size_t n, tb_char_t const* fmt, tb_va_list_t args)
{
// check
if (!n || !s || !fmt) return 0;
即当n等于0时,直接返回0。
期待的结果
然而标准库里的vsnprintf的行为是这样的:
If bufsz is zero, nothing is written and buffer may be a null pointer, however the return value (number of bytes that would be written not including the null terminator) is still calculated and returned.
参考:https://en.cppreference.com/w/c/io/vfprintf
错误信息
如果可能,请尽量附加程序运行过程中的错误输出信息。
相关环境
请提供编译和运行环境信息。
其他信息
请提供其他附加信息帮助我们诊断问题。
Metadata
Metadata
Assignees
Labels
No labels