Skip to content

Instantly share code, notes, and snippets.

@ramajd
Created January 18, 2020 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramajd/2630550eec8041deab7863f0273d424b to your computer and use it in GitHub Desktop.
Save ramajd/2630550eec8041deab7863f0273d424b to your computer and use it in GitHub Desktop.
macro argument string representation
#include <stdio.h>
#define WARN_IF(EXPR) \
if (EXPR) { \
fprintf(stderr, "Warning: " #EXPR "\n"); \
}
int main() {
int x = 1;
WARN_IF(x == 1);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment