Created
February 6, 2015 19:50
-
-
Save kazmura11/af6454d09b80e7eb7841 to your computer and use it in GitHub Desktop.
C言語のヘッダの書き方(global.h)
This file contains 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
#ifndef GLOBAL_H_INCLUDED__ | |
#define GLOBAL_H_INCLUDED__ | |
// グローバル変数の名前の衝突を避けるための工夫 | |
#ifdef GLOBAL_VARIABLE_DEFINED | |
# define GLOBAL /* INSTANCE */ | |
#else | |
# define GLOBAL extern /* EXTERN */ | |
#endif /* GLOBAL_VARIABLE_DEFINED */ | |
GLOBAL int g_foo; | |
GLOBAL int g_baz; | |
typedef struct foobar_tag | |
{ | |
int a; | |
int b; | |
} FooBar; | |
GLOBAL FooBar g_FooBar; | |
#endif /* GLOBAL_H_INCLUDED__ */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment