From 6055c39511cbe84b2255b2a8e57b837e9c634e23 Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Thu, 22 Feb 2018 09:54:23 -0600 Subject: [PATCH] Give the ranges enum a type This restricts the data type of the enum to uint16_t, so if anyone ever adds enough values to it to overflow the 16 bits that are available in the Key structure, even if they do it without an assignment (e.g. `TOO_BIG_ENUM = 0x10000`), it will result in a compilation error instead of runtime errors. --- src/Kaleidoscope-Ranges.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kaleidoscope-Ranges.h b/src/Kaleidoscope-Ranges.h index 88fc0c06..d08b28f1 100644 --- a/src/Kaleidoscope-Ranges.h +++ b/src/Kaleidoscope-Ranges.h @@ -21,7 +21,7 @@ namespace kaleidoscope { namespace ranges { -enum { +enum : uint16_t { FIRST = 0xc000, KALEIDOSCOPE_FIRST = FIRST, OS_FIRST,