Make sure rgb_color_t doesn't grow

For years the comment above the class claimed it was 4 bytes, but
it had grown to 5. Add a static_assert() to prevent that from
happening again.
This commit is contained in:
Aaron Gyes 2019-09-24 23:34:10 -07:00
parent ed0a7f5cdb
commit 8230755bfd

View File

@ -13,7 +13,8 @@ struct color24_t {
unsigned char rgb[3];
};
/// A type that represents a color. We work hard to keep it at a size of 4 bytes.
/// A type that represents a color. We work hard to keep it at a size of 4 bytes and verify with
/// static_assert
class rgb_color_t {
// Types
enum { type_none, type_named, type_rgb, type_normal, type_reset };
@ -169,4 +170,6 @@ class rgb_color_t {
static wcstring_list_t named_color_names(void);
};
static_assert(sizeof(rgb_color_t) <= 4, "rgb_color_t is too big");
#endif