Improve C89/C90 compatibility by conditionally including <stdint.h>
@KRASTM 已经在做这个了。
开始于 2026年8月14日。
评估
这个 Issue 还没有评估数据。
描述
The current implementation unconditionally includes the standard header file <stdint.h>. While this is valid for C99 and later standards, some toolchains, such as IAR Embedded Workbench configured for C89/C90 compliance, may not provide this header, resulting in compilation errors.
To improve compatibility with older C language standards while preserving existing functionality, the inclusion of <stdint.h> should be conditioned on the detected language standard.
Current Code
#include <stdint.h>
Proposed Fix
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
/* C89/C90 mode: Define standard integer types locally */
#else
/* C99 and later: Use standard stdint.h */
#include <stdint.h>
#endif
Rationale
<stdint.h> is part of the C99 standard and is not guaranteed to be available when compiling in C89/C90 mode. The proposed change allows the code to compile in both C89/C90 and C99+ environments by only including <stdint.h> when the language standard supports it.
Expected Benefit
- Improved compatibility with C89/C90 toolchains, including IAR Embedded Workbench.
- No functional impact on existing C99 and newer builds.
- Better portability across different compiler configurations.
- 主要语言
- C
- 星标
- 84
- 派生
- 24
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
microsoft/ebpf-for-windows#5604 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 84/100
AcademySoftwareFoundation/openexr#2683 ·
维护者通常 1 天内回复