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.

[参考译文] CCS/CC1310:编译器不支持 uint64_t?

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

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/715625/ccs-cc1310-uint64_t-not-supported-by-compiler

器件型号:CC1310

工具/软件:Code Composer Studio

您好!

我尝试使用 uint64_t (unsigned long)类型、但 sizeof (uint64_t)为我提供4个字节、而不是8个字节。 将8个字节写入 uint64_t 指针会导致内存损坏。

不 支持 uint64_t?

我使用 CCS8和 TI v18.1.0.LTS 编译器。

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

    [引用 user="Rustem Avkhadiev"] sizeof (uint64_t)为我提供4个字节而不是8个字节[/引用]

    我总是得到8。  对于您在看到4时编译的源文件、请按照文章 如何提交编译器测试用例中的说明提交测试用例。  如果不明显、请指明哪个函数获得4个字节的 sizeof (uint64_t)。

    谢谢、此致、

    乔治

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

    我已经使用了 SDK 中的"cc1310 pinStandby"示例,并在 mainThread()函数中插入了以下代码:

      长期试验;

      int size = sizeof (test);

    在调试器中、我看到该大小= 4。

    我的附加项目:

    e2e.ti.com/.../pinStandby_5F00_CC1310_5F00_LAUNCHXL_5F00_tirtos_5F00_ccs.rar

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

    [引用用户="Rustem Avkhadiev "]

     长期试验;

      int size = sizeof (test);

    [/报价]

    此代码计算 sizeof long 类型(4)、而不是 sizeof 类型 uint64_t (8)。

    谢谢、此致、

    乔治

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

    谢谢!
    是的、uint64_t 定义为"unsigned long long"、大小为8。
    但奇怪的是、在 gcc 编译器中、"long"的大小为8、而在 ti 编译器中、它的大小为4 (与 int 相同)。