diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2021-07-18 02:05:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-18 11:05:35 +0200 |
commit | 3723140044b99fde3f47df4f2e6a3ed4abdaba89 (patch) | |
tree | 495dad807d249d471b878681ea5245da70e33163 /lib | |
parent | 8091545f95143d520c64b14f88bb5ce2818c893c (diff) | |
download | Nim-3723140044b99fde3f47df4f2e6a3ed4abdaba89.tar.gz |
add NIM_STATIC_ASSERT(CHAR_BIT == 8, "") to fail-fast where assumption is violated (#18512)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/nimbase.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/nimbase.h b/lib/nimbase.h index cbd35605b..e480c55fd 100644 --- a/lib/nimbase.h +++ b/lib/nimbase.h @@ -325,6 +325,9 @@ typedef unsigned char NIM_BOOL; // best effort #endif NIM_STATIC_ASSERT(sizeof(NIM_BOOL) == 1, ""); // check whether really needed +NIM_STATIC_ASSERT(CHAR_BIT == 8, ""); + // fail fast for (rare) environments where this doesn't hold, as some implicit + // assumptions would need revisiting (e.g. `uint8` or https://github.com/nim-lang/Nim/pull/18505) #define NIM_TRUE true #define NIM_FALSE false |