This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] 编译器/TMS320F2.8379万D:printf 'z'说明符不支持size_t

Guru**** 2609285 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/635460/compiler-tms320f28379d-printf-z-specifier-doesn-t-work-with-size_t

部件号:TMS320F2.8379万D

工具/软件:TI C/C++编译器

以下代码输出'u'而不是正确的大小:

size_t numOctets =(sizeof(MACAddress)/sizeof(uint16_t));
printf ("numOctets =%zu\n",numOctets); 

我认为这是通过printf输出size_t类型的正确方法。

亲切,

Graham

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    直到C2000 17.9 .0.STS才支持'z'格式宽度说明符。 您需要将编译器更新为该版本,或者使用“(unsigned) numOctets”