File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// Copyright (c) 2020 by Chrono
22//
3+ // pre-process source:
4+ // g++ test03.cpp -E -o a.cxx
5+ //
36// g++ test03.cpp -std=c++98 -o a.out;./a.out
47// g++ test03.cpp -std=c++11 -o a.out;./a.out
58// g++ test03.cpp -std=c++14 -o a.out;./a.out
912// show all predefined macro:
1013// gcc -E -dM - < /dev/null
1114
15+ // comment it for better pre-process output
1216#include < iostream>
1317
18+ // macro for convienient namespace
1419#define BEGIN_NAMESPACE (x ) namespace x {
1520#define END_NAMESPACE (x ) }
1621
1722void case1 ()
23+ {
24+ #
25+ #if __linux__
26+ # define HAS_LINUX 1
27+ #endif
28+ #
29+ using namespace std ;
30+ cout << " linux is " << HAS_LINUX << endl;
31+ }
32+
33+ void case2 ()
1834{
1935 using namespace std ;
2036
@@ -73,6 +89,7 @@ END_NAMESPACE(my_own)
7389int main ()
7490{
7591 case1 ();
92+ case2 ();
7693
7794 my_own::case3 ();
7895 my_own::MyClass obj;
You can’t perform that action at this time.
0 commit comments