author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Mon, 22 Feb 2016 12:41:52 +0200 | |
changeset 1903 | 901e7394849f |
parent 1347 | 0147cb61177f |
child 1905 | fba288d59662 |
permissions | -rw-r--r-- |
1086 | 1 |
.. -*- coding: utf-8; -*- |
1334
9bf0d5a1f0cf
Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1105
diff
changeset
|
2 |
.. include:: HEADER.rst |
1086 | 3 |
|
4 |
======================= |
|
5 |
cpp (C preprocessor). |
|
6 |
======================= |
|
1344
4a4dabb9f8e4
Fix to satisfy structure convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1334
diff
changeset
|
7 |
.. contents:: |
1086 | 8 |
|
9 |
How to see macros expansion? |
|
10 |
============================ |
|
11 |
||
12 |
GCC:: |
|
13 |
||
14 |
$ cpp <file>.c |
|
15 |
||
16 |
MSVC:: |
|
17 |
||
18 |
$ cl /E <file>.c |
|
19 |
||
1347
0147cb61177f
Fix typo. Add about Emacs and cpp.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1344
diff
changeset
|
20 |
Under Emacs select region and type ``C-c C-e``. |
0147cb61177f
Fix typo. Add about Emacs and cpp.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1344
diff
changeset
|
21 |
|
0147cb61177f
Fix typo. Add about Emacs and cpp.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1344
diff
changeset
|
22 |
How to see predefined macros? |
1086 | 23 |
============================= |
24 |
||
25 |
See: |
|
26 |
||
27 |
http://predef.sourceforge.net/ |
|
1105 | 28 |
``predef`` project on Sourceforge |
1086 | 29 |
http://en.wikipedia.org/wiki/C_preprocessor#Compiler-specific_predefined_macros |
1105 | 30 |
Compiler specific predefined macros |
1087
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
31 |
http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
32 |
Predefined Macros |
1086 | 33 |
|
34 |
GNU C Compiler:: |
|
35 |
||
36 |
$ gcc -dM -E - < /dev/null |
|
37 |
||
38 |
HP-UX ansi C compiler:: |
|
39 |
||
40 |
$ cc -v EMPTY.c |
|
41 |
||
42 |
SCO OpenServer C compiler:: |
|
43 |
||
44 |
$ cc -## EMPTY.c |
|
45 |
||
46 |
Sun Studio C/C++ compiler:: |
|
47 |
||
48 |
$ cc -## EMPTY.c |
|
49 |
||
50 |
IBM AIX XL C/C++ compiler:: |
|
51 |
||
52 |
$ cc -qshowmacros -E EMPTY.c |
|
53 |
||
54 |
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
|
55 |
command line... But some macros documented: |
1086 | 56 |
|
1087
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
57 |
_MSC_VER |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
58 |
Defines the compiler version. Always defined. |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
59 |
_WIN32 |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
60 |
Defined for applications for Win32. Always defined. |
1086 | 61 |
|
1087
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
62 |