c - 将项目从 64 位移植到 32 位时 : float changed to long double gives error for %f

标签 c printf 32bit-64bit porting

在将 64 位项目移植到 32 位项目以进行范围兼容更改时:

typedef float float_t;

typedef long double float_t;

一切顺利,但 %f 的所有 printf 说明符都出现错误。我不想在整个代码中更改为 %Le。

请提出任何通用的解决方案,使其在 c 语言中兼容 32 位和 64 位系统。

最佳答案

您将不得不为 float/long double 的格式字符串使用#define,或者使用特殊的格式化函数

关于c - 将项目从 64 位移植到 32 位时 : float changed to long double gives error for %f,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9942800/

相关文章:

对 execve 的调用参数太少,但应该接收全部参数

c - getchar() 与变量不一致

c - 为什么 main 没有声明为 extern

c++ - 变量周围的堆栈...已损坏

python - 32 位模块如何在 64 位 Python 上运行?

sql-server - 32位应用程序可以访问64位sql server数据库吗?

c - 如何检查 no 是否为阶乘?

c - scanf 和 printf 中的无效 int

c++ - 在 C++ 中将 MQLONG 值转换为字符串

ios - 我的应用程序中的 cocoapods 框架比示例中慢得多