From: misomosi Date: Wed, 27 May 2026 18:12:27 +0000 (-0400) Subject: Add freestanding libc notes X-Git-Url: http://git.misomosispi.com/?a=commitdiff_plain;h=b98184890582cdd3d3841ccaddcfa218b53e3f5c;p=gists.git Add freestanding libc notes --- diff --git a/FSLibcNotes/README.md b/FSLibcNotes/README.md new file mode 100644 index 0000000..81cbefc --- /dev/null +++ b/FSLibcNotes/README.md @@ -0,0 +1,58 @@ +# Freestanding libc notes + +Notes I have for using libc functions even in a freestanding environment + +## Allowable Headers in Freestanding environment + +These headers are allowable because they're computation +or compiler/language-based and implementable without +arch/OS-specific support. + +* ctype.h +* stdckdint.h +* errno.h +* float.h +* inttypes.h +* iso646.h +* limits.h +* math.h +* stdalign.h +* stdarg.h +* stdbit.h +* stdbool.h +* stdalign.h +* stdcountof.h +* stddef.h +* stdint.h +* stdmchar.h +* stdnoreturn.h +* string.h +* stdlib.h +* tgmath.h +* uchar.h +* wchar.h +* wctype.h + +## Semi-Allowable Headers in Freestanding Environments: + +These headers are allowable, but with caveats because +some functions rely on functionality via arch/OS-specific support + +* stdlib.h (Process control functions are not allowed) +* stdio.h (FILE objects are not allowed, printf is allowed) +* time.h (Time manipulation is not allowed) + +## Non-Allowable Headers in Freestanding Environments + +These headers are generally not allowed because they're +hard to implement without arch/OS-specific support, they're +optional in std C, they're tricky/bad practice, etc. + +* assert.h (Hard to implement without process control) +* complex.h (Optional in std C) +* fenv.h (Hard to implement without arch-specific support) +* stdatomic.h (Optional in std C) +* threads.h (Optional in std C) +* signal.h (UNIX-only) +* setjmp.h (Hard to implement without arch-specific support) +* locale.h (Introduces inconsistencies and gotchas in I/O)