author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Mon, 28 Nov 2011 01:09:29 +0200 | |
changeset 1110 | 6e71ffc71972 |
parent 1105 | f50956d9293a |
child 1334 | 9bf0d5a1f0cf |
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/ |
|
1105 | 24 |
``predef`` project on Sourceforge |
1086 | 25 |
http://en.wikipedia.org/wiki/C_preprocessor#Compiler-specific_predefined_macros |
1105 | 26 |
Compiler specific predefined macros |
1087
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
27 |
http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
28 |
Predefined Macros |
1086 | 29 |
|
30 |
GNU C Compiler:: |
|
31 |
||
32 |
$ gcc -dM -E - < /dev/null |
|
33 |
||
34 |
HP-UX ansi C compiler:: |
|
35 |
||
36 |
$ cc -v EMPTY.c |
|
37 |
||
38 |
SCO OpenServer C compiler:: |
|
39 |
||
40 |
$ cc -## EMPTY.c |
|
41 |
||
42 |
Sun Studio C/C++ compiler:: |
|
43 |
||
44 |
$ cc -## EMPTY.c |
|
45 |
||
46 |
IBM AIX XL C/C++ compiler:: |
|
47 |
||
48 |
$ cc -qshowmacros -E EMPTY.c |
|
49 |
||
50 |
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
|
51 |
command line... But some macros documented: |
1086 | 52 |
|
1087
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
53 |
_MSC_VER |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
54 |
Defines the compiler version. Always defined. |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
55 |
_WIN32 |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
56 |
Defined for applications for Win32. Always defined. |
1086 | 57 |
|
1087
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
58 |