1<html lang="en"> 2<head> 3<title>C++ Named Operators - The C Preprocessor</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="The C Preprocessor"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Predefined-Macros.html#Predefined-Macros" title="Predefined Macros"> 9<link rel="prev" href="System_002dspecific-Predefined-Macros.html#System_002dspecific-Predefined-Macros" title="System-specific Predefined Macros"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<!-- 12Copyright (C) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 131997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 142008, 2009, 2010, 2011 15Free Software Foundation, Inc. 16 17Permission is granted to copy, distribute and/or modify this document 18under the terms of the GNU Free Documentation License, Version 1.3 or 19any later version published by the Free Software Foundation. A copy of 20the license is included in the 21section entitled ``GNU Free Documentation License''. 22 23This manual contains no Invariant Sections. The Front-Cover Texts are 24(a) (see below), and the Back-Cover Texts are (b) (see below). 25 26(a) The FSF's Front-Cover Text is: 27 28 A GNU Manual 29 30(b) The FSF's Back-Cover Text is: 31 32 You have freedom to copy and modify this GNU Manual, like GNU 33 software. Copies published by the Free Software Foundation raise 34 funds for GNU development. 35--> 36<meta http-equiv="Content-Style-Type" content="text/css"> 37<style type="text/css"><!-- 38 pre.display { font-family:inherit } 39 pre.format { font-family:inherit } 40 pre.smalldisplay { font-family:inherit; font-size:smaller } 41 pre.smallformat { font-family:inherit; font-size:smaller } 42 pre.smallexample { font-size:smaller } 43 pre.smalllisp { font-size:smaller } 44 span.sc { font-variant:small-caps } 45 span.roman { font-family:serif; font-weight:normal; } 46 span.sansserif { font-family:sans-serif; font-weight:normal; } 47--></style> 48<link rel="stylesheet" type="text/css" href="../cs.css"> 49</head> 50<body> 51<div class="node"> 52<a name="C++-Named-Operators"></a> 53<a name="C_002b_002b-Named-Operators"></a> 54<p> 55Previous: <a rel="previous" accesskey="p" href="System_002dspecific-Predefined-Macros.html#System_002dspecific-Predefined-Macros">System-specific Predefined Macros</a>, 56Up: <a rel="up" accesskey="u" href="Predefined-Macros.html#Predefined-Macros">Predefined Macros</a> 57<hr> 58</div> 59 60<h4 class="subsection">3.7.4 C++ Named Operators</h4> 61 62<p><a name="index-named-operators-65"></a><a name="index-C_002b_002b-named-operators-66"></a><a name="index-g_t_0040file_007biso646_002eh_007d-67"></a> 63In C++, there are eleven keywords which are simply alternate spellings 64of operators normally written with punctuation. These keywords are 65treated as such even in the preprocessor. They function as operators in 66‘<samp><span class="samp">#if</span></samp>’, and they cannot be defined as macros or poisoned. In C, you 67can request that those keywords take their C++ meaning by including 68<samp><span class="file">iso646.h</span></samp>. That header defines each one as a normal object-like 69macro expanding to the appropriate punctuator. 70 71 <p>These are the named operators and their corresponding punctuators: 72 73 <p><table summary=""><tr align="left"><td valign="top">Named Operator </td><td valign="top">Punctuator 74<br></td></tr><tr align="left"><td valign="top"><code>and</code> </td><td valign="top"><code>&&</code> 75<br></td></tr><tr align="left"><td valign="top"><code>and_eq</code> </td><td valign="top"><code>&=</code> 76<br></td></tr><tr align="left"><td valign="top"><code>bitand</code> </td><td valign="top"><code>&</code> 77<br></td></tr><tr align="left"><td valign="top"><code>bitor</code> </td><td valign="top"><code>|</code> 78<br></td></tr><tr align="left"><td valign="top"><code>compl</code> </td><td valign="top"><code>~</code> 79<br></td></tr><tr align="left"><td valign="top"><code>not</code> </td><td valign="top"><code>!</code> 80<br></td></tr><tr align="left"><td valign="top"><code>not_eq</code> </td><td valign="top"><code>!=</code> 81<br></td></tr><tr align="left"><td valign="top"><code>or</code> </td><td valign="top"><code>||</code> 82<br></td></tr><tr align="left"><td valign="top"><code>or_eq</code> </td><td valign="top"><code>|=</code> 83<br></td></tr><tr align="left"><td valign="top"><code>xor</code> </td><td valign="top"><code>^</code> 84<br></td></tr><tr align="left"><td valign="top"><code>xor_eq</code> </td><td valign="top"><code>^=</code> 85 <br></td></tr></table> 86 87 </body></html> 88 89