Skip to content

Instantly share code, notes, and snippets.

@coffeenotfound
Created September 21, 2018 11:31
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save coffeenotfound/2305c3a2bc1dff0513f52ac178cb5616 to your computer and use it in GitHub Desktop.
Save coffeenotfound/2305c3a2bc1dff0513f52ac178cb5616 to your computer and use it in GitHub Desktop.
Visual Studio Code C Include Guard Snippet
{
"Add include guard": {
"prefix": "guard",
"description": "Adds an ifndef include guard to a C header",
"body": [
"#ifndef __${TM_FILENAME/^([^\\.]*)\\..*$/${1:/upcase}/}_${TM_FILENAME/^.*\\.([^\\.]*)$/${1:/upcase}/}__",
"#define __${TM_FILENAME/^([^\\.]*)\\..*$/${1:/upcase}/}_${TM_FILENAME/^.*\\.([^\\.]*)$/${1:/upcase}/}__",
"",
"$0",
"",
"#endif // __${TM_FILENAME/^([^\\.]*)\\..*$/${1:/upcase}/}_${TM_FILENAME/^.*\\.([^\\.]*)$/${1:/upcase}/}__",
""
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment