Created
April 6, 2025 18:31
-
-
Save abiiranathan/c491c17a4e56505efc828fbb44feb3ed to your computer and use it in GitHub Desktop.
C header guard vscode snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"C++ Header Guard with extern C": { | |
"prefix": "guard", | |
"body": [ | |
"#ifndef ${1:${TM_FILENAME_BASE/(.*)/${1:/upcase}_H/}}", | |
"#define ${1:${TM_FILENAME_BASE/(.*)/${1:/upcase}_H/}}", | |
"", | |
"#ifdef __cplusplus", | |
"extern \"C\" {", | |
"#endif", | |
"", | |
"$0", | |
"", | |
"#ifdef __cplusplus", | |
"}", | |
"#endif", | |
"", | |
"#endif // ${1}", | |
"\n" | |
], | |
"description": "Add C++ header guard with extern C protection against name mangling" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment