Predefined Macros
Several object-like macros are predefined; you use them without supplying their definitions. They fall into three classes: standard, common, and system-specific.
In C++, there is a fourth category, the named operators. They act like predefined macros, but you cannot undefine them.
Predefined macros 조회 방법
Predefined 매크로는 이름에 두 개의 underscore 가 붙습니다.
$ cpp -dM /dev/null
$ cpp -dM /dev/null | wc -l
348
$ cpp -dM -xc++ /dev/null # C++
$ cpp -dM -xc++ /dev/null | wc -l
390
공통으로 존재하는 매크로는 제외하고 출력 ( FULL JOIN )
$ awk 'BEGIN {
while (getline < ARGV[1] > 0) a[$2]=$0
while (getline < ARGV[2] > 0) b[$2]=$0
for (i in a) if ( !b[i] ) print "C: ", a[i]
for (i in b) if ( !a[i] ) print "C++: ", b[i]
}' <( cpp -dM /dev/null ) <( cpp -dM -xc++ /dev/null )
C: #define __STDC_VERSION__ 201710L
C++: #define __cpp_ref_qualifiers 200710
C++: #define __cpp_exceptions 199711
C++: #define __cpp_generic_lambdas 201304
C++: #define __cpp_nsdmi 200809
C++: #define __GNUG__ 9
. . .
. . .