diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-14 18:49:34 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-14 18:49:34 +0100 |
| commit | ce25bbd863904ac7784b647b6b8e22196e7674ff (patch) | |
| tree | e4e11995999db844bee50692e63d5c117af3e2f9 /src/blog/2023-11-14-test-visibility-c-macro/foo4.c | |
| parent | 5ed505e280c6c6a7459bb2e4249313fa65df052f (diff) | |
| download | sebastiano.tronto.net-ce25bbd863904ac7784b647b6b8e22196e7674ff.tar.gz sebastiano.tronto.net-ce25bbd863904ac7784b647b6b8e22196e7674ff.zip | |
Added blog post
Diffstat (limited to 'src/blog/2023-11-14-test-visibility-c-macro/foo4.c')
| -rw-r--r-- | src/blog/2023-11-14-test-visibility-c-macro/foo4.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/blog/2023-11-14-test-visibility-c-macro/foo4.c b/src/blog/2023-11-14-test-visibility-c-macro/foo4.c new file mode 100644 index 0000000..85dea34 --- /dev/null +++ b/src/blog/2023-11-14-test-visibility-c-macro/foo4.c | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | #include <stdio.h> | ||
| 2 | |||
| 3 | /* cc -DTEST main4.c # foo is visible */ | ||
| 4 | /* cc main4.c # foo is static */ | ||
| 5 | |||
| 6 | #ifdef TEST | ||
| 7 | #define _static | ||
| 8 | #else | ||
| 9 | #define _static static | ||
| 10 | #endif | ||
| 11 | |||
| 12 | _static int foo(int x, int y) | ||
| 13 | { | ||
| 14 | return 42*x - 69*y; | ||
| 15 | } | ||
