Skip to content

Instantly share code, notes, and snippets.

@OlivierLDff
Created July 13, 2018 08:40
Show Gist options
  • Save OlivierLDff/51983c134487a36169dbd58bc3a49290 to your computer and use it in GitHub Desktop.
Save OlivierLDff/51983c134487a36169dbd58bc3a49290 to your computer and use it in GitHub Desktop.
#ifdef __GNUC__
/*code for GNU C compiler */
#define PRE_PACKED_ENUM_DEF
#define POST_PACKED_ENUM_DEF __attribute__((packed));
#elif _MSC_VER
/*code specific to MSVC compiler*/
#define PRE_PACKED_ENUM_DEF __pragma(pack(push, 1))
#define POST_PACKED_ENUM_DEF __pragma(pack(pop));
#elif __MINGW32__
/*code specific to mingw compilers*/
#define PRE_PACKED_ENUM_DEF
#define POST_PACKED_ENUM_DEF __attribute__((packed));
#else
#error "compiler not supported : see OsDef.hpp to fix"
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment