You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
然而标准库里的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.
Bot detected the issue body's language is not English, translate it automatically.
This is not completely benchmarking the standard library, but only provides cross-platform behavior consistency of its own interfaces and ensures that its current needs are sufficient. So at the beginning, this extremely infrequently used case was completely dealt with, and it was as light as possible. . There is no need to write a lot of processing code for a bunch of cases that you don't usually use.
Under normal circumstances, here, I can directly assert(n) and force an error to not be passed on a case with n = 0.
描述问题
tbox目前的实现是这样的
即当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
错误信息
如果可能,请尽量附加程序运行过程中的错误输出信息。
相关环境
请提供编译和运行环境信息。
其他信息
请提供其他附加信息帮助我们诊断问题。
The text was updated successfully, but these errors were encountered: