author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Mon, 22 Feb 2016 13:34:55 +0200 | |
changeset 1911 | 870693ce6ff0 |
parent 1905 | fba288d59662 |
child 1912 | 8b81a8f0f692 |
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:: |
1905
fba288d59662
Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1347
diff
changeset
|
8 |
:local: |
1086 | 9 |
|
10 |
How to see macros expansion? |
|
11 |
============================ |
|
12 |
||
13 |
GCC:: |
|
14 |
||
15 |
$ cpp <file>.c |
|
16 |
||
17 |
MSVC:: |
|
18 |
||
19 |
$ cl /E <file>.c |
|
20 |
||
1347
0147cb61177f
Fix typo. Add about Emacs and cpp.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1344
diff
changeset
|
21 |
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
|
22 |
|
0147cb61177f
Fix typo. Add about Emacs and cpp.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1344
diff
changeset
|
23 |
How to see predefined macros? |
1086 | 24 |
============================= |
25 |
||
26 |
See: |
|
27 |
||
28 |
http://predef.sourceforge.net/ |
|
1105 | 29 |
``predef`` project on Sourceforge |
1086 | 30 |
http://en.wikipedia.org/wiki/C_preprocessor#Compiler-specific_predefined_macros |
1105 | 31 |
Compiler specific predefined macros |
1087
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
32 |
http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
33 |
Predefined Macros |
1086 | 34 |
|
35 |
GNU C Compiler:: |
|
36 |
||
37 |
$ gcc -dM -E - < /dev/null |
|
38 |
||
39 |
HP-UX ansi C compiler:: |
|
40 |
||
41 |
$ cc -v EMPTY.c |
|
42 |
||
43 |
SCO OpenServer C compiler:: |
|
44 |
||
45 |
$ cc -## EMPTY.c |
|
46 |
||
47 |
Sun Studio C/C++ compiler:: |
|
48 |
||
49 |
$ cc -## EMPTY.c |
|
50 |
||
51 |
IBM AIX XL C/C++ compiler:: |
|
52 |
||
53 |
$ cc -qshowmacros -E EMPTY.c |
|
54 |
||
55 |
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
|
56 |
command line... But some macros documented: |
1086 | 57 |
|
1087
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
58 |
_MSC_VER |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
59 |
Defines the compiler version. Always defined. |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
60 |
_WIN32 |
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
61 |
Defined for applications for Win32. Always defined. |
1086 | 62 |
|
1087
e1b19e1e7031
Add info about _MSC_VER
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1086
diff
changeset
|
63 |