Skip to content

Commit eb81bee

Browse files
committed
test03.cpp
1 parent c7a49ff commit eb81bee

1 file changed

Lines changed: 37 additions & 26 deletions

File tree

section1/test03.cpp

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,43 @@ void case1()
3232

3333
void case2()
3434
{
35+
#define CUBE(a) (a) * (a) * (a)
36+
37+
cout << CUBE(10) << endl;
38+
cout << CUBE(15) << endl;
39+
40+
#undef CUBE
41+
42+
#ifdef AUTH_PWD
43+
# undef AUTH_PWD
44+
#endif
45+
#define AUTH_PWD "xxx"
46+
47+
cout << AUTH_PWD << endl;
48+
49+
#define MAX_BUF_LEN 65535
50+
#define VERSION "1.0.18"
51+
}
52+
53+
// macro for convienient namespace
54+
#define BEGIN_NAMESPACE(x) namespace x {
55+
#define END_NAMESPACE(x) }
56+
57+
BEGIN_NAMESPACE(my_own)
58+
59+
class MyClass final
60+
{
61+
};
62+
63+
void case3()
64+
{
65+
cout << "working in own namespace" << endl;
66+
}
67+
68+
END_NAMESPACE(my_own)
69+
70+
void case4()
71+
{
3572

3673
#if __cplusplus >= 201402
3774
cout << "c++14 or later" << endl;
@@ -70,32 +107,6 @@ void case2()
70107

71108
}
72109

73-
// macro for convienient namespace
74-
#define BEGIN_NAMESPACE(x) namespace x {
75-
#define END_NAMESPACE(x) }
76-
77-
BEGIN_NAMESPACE(my_own)
78-
79-
class MyClass final
80-
{
81-
};
82-
83-
void case3()
84-
{
85-
cout << "working in own namespace" << endl;
86-
}
87-
88-
END_NAMESPACE(my_own)
89-
90-
void case4()
91-
{
92-
#define CUBE(a) (a) * (a) * (a)
93-
94-
cout << CUBE(10) << endl;
95-
96-
#undef CUBE
97-
}
98-
99110
int main()
100111
{
101112
case1();

0 commit comments

Comments
 (0)