author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Sat, 10 Feb 2018 01:49:07 +0200 | |
changeset 2230 | 9e6ad6607a9e |
parent 2228 | 837f1337c59b |
permissions | -rw-r--r-- |
1086 | 1 |
.. -*- coding: utf-8; -*- |
2 |
||
3 |
======================= |
|
4 |
cpp (C preprocessor). |
|
5 |
======================= |
|
1344
4a4dabb9f8e4
Fix to satisfy structure convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1334
diff
changeset
|
6 |
.. contents:: |
1905
fba288d59662
Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1347
diff
changeset
|
7 |
:local: |
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 |
||
2228
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
27 |
http://predef.sourceforge.net/ |
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
28 |
``predef`` project on Sourceforge |
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
29 |
http://en.wikipedia.org/wiki/C_preprocessor#Compiler-specific_predefined_macros |
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
30 |
Compiler specific predefined macros |
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
31 |
http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
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 |
|
2228
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
57 |
``_MSC_VER`` |
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
58 |
Defines the compiler version. Always defined. |
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
diff
changeset
|
59 |
``_WIN32`` |
837f1337c59b
Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1912
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 |