Skip to content

Instantly share code, notes, and snippets.

@csknns
Last active April 22, 2022 09:43
Show Gist options
  • Save csknns/c76a3c8ed8e291eed1e2eb5b8ebcd3e4 to your computer and use it in GitHub Desktop.
Save csknns/c76a3c8ed8e291eed1e2eb5b8ebcd3e4 to your computer and use it in GitHub Desktop.
// Helper macros to convert a preprocessor token to String
#define xstr(s) str(s)
#define str(s) #s
// Example of compile time assertions to validate that tha macro argument was not empty
// and avoid building a application that will fail at runtime
// Clang and gcc are both able to compute this at compile-time, you can use sizeOf()
// instead of the build-in method here.
_Static_assert(__builtin_strlen(xstr(OAUTH_CLIENT_ID)) > 0,
"The OAUTH_CLIENT_ID is missing");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment