Improve C89/C90 compatibility by conditionally including <stdint.h>
@KRASTM đang làm issue này rồi.
Từ ngày 14/8/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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.
- Ngôn ngữ chính
- C
- Star
- 84
- Fork
- 24
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của STMicroelectronics/cmsis-core
-
[Bug]: Discrepancy in __NVIC_PRIO_BITS default value between core_cm4.h and CMSIS-Core Documentation Đang mởbug cmsis
STMicroelectronics/cmsis-core#9 · 1 bình luận · 1 người được giao ·
Tất cả issue của STMicroelectronics/cmsis-core
Issue tương tự
-
task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
vsanthanam/JBird#429 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
bug documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
es-ude/OnDeviceTraining#459 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
bilelmoussaoui/gobject-linter#199 · 1 bình luận ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
bradcypert/plum#53 ·