Proposal: Disallow C++ “C wrapper” headers in Axmol core and maintained extensions #3213
Closed
halx99
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
🚫 Proposal: Disallow C++ “C wrapper” headers in Axmol core and maintained extensions
Background
In Axmol’s core engine and extension libraries fully maintained by the Axmol team, we currently see mixed usage of C++ “C wrapper” headers (e.g.
<cstdio>,<cstring>,<cstdlib>) alongside pure C headers (e.g.<stdio.h>,<string.h>).This inconsistency introduces several problems:
<cxxx>headers place symbols both in the global namespace and instd::, which can cause ambiguity and conflicts.<cxxx>headers with subtle differences, making cross‑platform builds less predictable.printf,malloc, etc.) instead of modern C++ alternatives (fmt::format,std::vector, RAII).Proposed Rule
For Axmol core and Axmol‑maintained extension libraries:
Ban inclusion of C++ “C wrapper” headers
<cstdio>,<cstdlib>,<cstring>,<ctime>, etc.Allow inclusion of pure C standard headers where necessary
<stddef.h>(forsize_t,ptrdiff_t,offsetof)<stdint.h>(for fixed‑width integer types)<string.h>(formemcpy,memmove,memset,memcmp)<assert.h>(for assertions)(include sutiable overloads math APIs), (include std::nullptr_t) allowed
Prefer modern C++ alternatives in core logic
fmtorstd::formatstd::vector,std::array,std::unique_ptrstd::string,std::string_viewstd::chronoPlatform adaptation layer exception
Benefits
Action Items
CODING_STYLE.mdorCONTRIBUTING.md.<cxxx>headers in Axmol core and maintained extensions.PR: #3214
All reactions