Skip to content

Latest commit

 

History

History
123 lines (89 loc) · 2.25 KB

File metadata and controls

123 lines (89 loc) · 2.25 KB
title Preprocessor Grammar | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.technology
cpp-tools
ms.tgt_pltfrm
ms.topic article
dev_langs
C++
helpviewer_keywords
preprocessor
grammar, preprocessor
preprocessor, grammar
ms.assetid 6cd33fad-0b08-4592-9be8-7359c43e24e9
caps.latest.revision 7
author corob-msft
ms.author corob
manager ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

Preprocessor Grammar

#define identifier token-stringopt

# define identifier[( identifieropt**,** ... , identifieropt )] token-stringopt

defined( identifier )

defined identifier

#include "path-spec"

#include <path-spec>

#line digit-sequence " filename **"**opt

# undef identifier

#error token-string

#pragma token-string

conditional :
if-part elif-partsoptelse-partoptendif-line

if-part :
if-linetext

if-line :
#if constant-expression

#ifdef identifier

#ifndef identifier

elif-parts :
elif-line text

elif-parts elif-line text

elif-line :
#elif constant-expression

else-part :
else-linetext

else-line :
#else

endif-line :
#endif

digit-sequence :
digit

digit-sequence digit

digit : one of
0 1 2 3 4 5 6 7 8 9

token-string :
String of tokens

token :
keyword

identifier

constant

operator

punctuator

filename :
Legal operating system filename

path-spec :
Legal file path

text :
Any sequence of text

Note

The following nonterminals are expanded in the Lexical Conventions section of the C++ Language Reference: constant, constant-expression, identifier, keyword, operator, and punctuator.

See Also

Grammar Summary (C/C++)