Skip to content

Instantly share code, notes, and snippets.

@bolry
Created December 30, 2017 11:08
Show Gist options
  • Save bolry/2977b59ef4e6300582f95a3245168ffe to your computer and use it in GitHub Desktop.
Save bolry/2977b59ef4e6300582f95a3245168ffe to your computer and use it in GitHub Desktop.
Let compiler check you typedefs
typedef struct {
char int8_err [-1 + 2 * (sizeof(int8_t) == 1)];
char uint8_err [-1 + 2 * (sizeof(uint8_t) == 1)];
char int16_err [-1 + 2 * (sizeof(int16_t) == 2)];
char uint16_err[-1 + 2 * (sizeof(uint16_t) == 2)];
char int32_err [-1 + 2 * (sizeof(int32_t) == 4)];
char uint32_err[-1 + 2 * (sizeof(uint32_t) == 4)];
} throwaway_t;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment