Poco 记录 64 位数字

Poco logging 64 bit numbers

我一定是瞎了,因为我看不到这个...

我在一段代码周围有一个 Poco::Stopwatch,我知道我可以用 Clock::ClockDiff elapsed() const; 得到结果,其中 ClockDiffInt64

我想使用 poco_information_f1("x() took %?? us", diff); 记录结果,但找不到 ?? 的魔法值。 Google 建议 %lld%Ld 是正确的说明符,但都显示为 [ERRFMT]

有什么提示吗?

poco_information_f1 是一个解析为将参数传递给 Poco::format 的宏,其文档为 here.

所以正确的修饰符是 %?d,它将采用从 short 到 64 位 int 的任何整数类型。您几乎猜到了 %?? :D

之所以有效,是因为 Poco::format 不是 C 风格的可变参数函数;相反,它采用 Poco::Any 类型的额外参数,因此该函数确切地知道参数是什么数据类型。