cpp.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sun, 13 Nov 2011 18:57:57 +0200
changeset 1086 66ecbe32a2af
child 1087 e1b19e1e7031
permissions -rw-r--r--
simplify text.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1086
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
.. -*- coding: utf-8; -*-
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
=======================
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
 cpp (C preprocessor).
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
=======================
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
How to see macros expansion?
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
============================
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
GCC::
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
  $ cpp <file>.c
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
MSVC::
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
  $ cl /E <file>.c
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
Who to see predefined macros?
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
=============================
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
See:
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
  http://predef.sourceforge.net/
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
  http://en.wikipedia.org/wiki/C_preprocessor#Compiler-specific_predefined_macros
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
GNU C Compiler::
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
  $ gcc -dM -E - < /dev/null
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
HP-UX ansi C compiler::
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
  $ cc -v EMPTY.c
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
SCO OpenServer C compiler::
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
  $ cc -## EMPTY.c
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
Sun Studio C/C++ compiler::
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
  $ cc -## EMPTY.c
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
IBM AIX XL C/C++ compiler::
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
  $ cc -qshowmacros -E EMPTY.c
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
For Visual Studio compiler there no any possibility get predefined macros from
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
command line...
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
  http://msdn.microsoft.com/en-us/library/b0084kay.aspx
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
                Predefined Macros
66ecbe32a2af simplify text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51