author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Sun, 27 Nov 2011 23:21:26 +0200 | |
changeset 1098 | db420d971363 |
parent 1087 | e1b19e1e7031 |
child 1105 | f50956d9293a |
permissions | -rw-r--r-- |
1086 | 1 |
.. -*- coding: utf-8; -*- |
2 |
||
3 |
======================= |
|
4 |
cpp (C preprocessor). |
|
5 |
======================= |
|
6 |
||
7 |
How to see macros expansion? |
|
8 |
============================ |
|
9 |
||
10 |
GCC:: |
|
11 |
||
12 |
$ cpp <file>.c |
|
13 |
||
14 |
MSVC:: |
|
15 |
||
16 |
$ cl /E <file>.c |
|
17 |
||
18 |
Who to see predefined macros? |
|
19 |
============================= |
|
20 |
||
21 |
See: |
|
22 |
||
23 |
http://predef.sourceforge.net/ |
|
24 |
http://en.wikipedia.org/wiki/C_preprocessor#Compiler-specific_predefined_macros |
|
1087
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
25 |
http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
26 |
Predefined Macros |
1086 | 27 |
|
28 |
GNU C Compiler:: |
|
29 |
||
30 |
$ gcc -dM -E - < /dev/null |
|
31 |
||
32 |
HP-UX ansi C compiler:: |
|
33 |
||
34 |
$ cc -v EMPTY.c |
|
35 |
||
36 |
SCO OpenServer C compiler:: |
|
37 |
||
38 |
$ cc -## EMPTY.c |
|
39 |
||
40 |
Sun Studio C/C++ compiler:: |
|
41 |
||
42 |
$ cc -## EMPTY.c |
|
43 |
||
44 |
IBM AIX XL C/C++ compiler:: |
|
45 |
||
46 |
$ cc -qshowmacros -E EMPTY.c |
|
47 |
||
48 |
For Visual Studio compiler there no any possibility get predefined macros from |
|
1087
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
49 |
command line... But some macros documented: |
1086 | 50 |
|
1087
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
51 |
_MSC_VER |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
52 |
Defines the compiler version. Always defined. |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
53 |
_WIN32 |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
54 |
Defined for applications for Win32. Always defined. |
1086 | 55 |
|
1087
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
56 |