Alternative operator representations
Aus cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
C + + (und C) Quellcode kann in jedem Nicht-ASCII-7-Bit-Zeichensatz, der ISO 646/ECMA-6 invarianten Zeichensatz enthält geschrieben werden. Jedoch mehrere C + + Betreiber und Interpunktionszeichen erfordern Zeichen, die außerhalb des ISO 646 Codesatz sind:
{, }, [, ], #, \, ^, |, ~
. Um Zeichenkodierungen denen einige oder alle dieser Symbole nicht existieren verwenden, C + + definiert zwei Arten von Alternativen: zusätzliche Schlüsselwörter, die den Betreibern, die diese Zeichen und spezielle Kombinationen von zwei oder drei ISO 646 kompatible Zeichen interpretiert werden, verwenden entsprechen als wären sie eine einzige nicht-ISO 646 Zeichensatz .Original:
C++ (and C) source code may be written in any non-ASCII 7-bit character set that includes the ISO 646/ECMA-6 invariant character set. However, several C++ operators and punctuators require characters that are outside of the ISO 646 codeset:
{, }, [, ], #, \, ^, |, ~
. To be able to use character encodings where some or all of these symbols do not exist, C++ defines two kinds of alternatives: additional keywords that correspond to the operators that use these characters and special combinations of two or three ISO 646 compatible characters that are interpreted as if they were a single non-ISO 646 character.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Inhaltsverzeichnis |
[Bearbeiten] Alternative Schlüsselwörter
Es gibt alternative Schreibweisen für mehrere Betreiber als Schlüsselwörter in der C + +-Standard definiert .
Original:
There are alternative spellings for several operators defined as keywords in the C++ standard.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Primary | Alternative |
---|---|
&&
|
and
|
&=
|
and_eq
|
&
|
bitand
|
|
|
bitor
|
~
|
compl
|
!
|
not
|
!=
|
not_eq
|
|| | or |
|=
|
or_eq
|
^
|
xor
|
^=
|
xor_eq
|
[Bearbeiten] Kompatibilität mit C
Die gleichen Wörter werden in der Programmiersprache C in der Include-Datei <iso646.h> als Makros definiert. Da in C + + sind Schlüsselwörter der Sprache, die C + +-Version von <iso646.h> sowie <ciso646>, definiert nicht alles .
Original:
The same words are defined in the C programming language in the include file <iso646.h> as macros. Because in C++ these are language keywords, the C++ version of <iso646.h>, as well as <ciso646>, does not define anything.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Digraphen und trigraphs
Die folgenden Kombinationen von zwei und drei Zeichen (Digraphen und trigraphs) gelten Substitutionen für ihre jeweiligen primären Zeichen:
Original:
The following combinations of two and three characters (digraphs and trigraphs) are valid substitutions for their respective primary characters:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Primary | Digraph | Trigraph |
---|---|---|
{ |
<% |
??<
|
None } |
%> |
??>
|
[ |
<: |
??(
|
] |
:> |
??)
|
# |
%: |
??=
|
\ |
??/
| |
^ |
??'
| |
| |
??!
| |
~ |
??-
|
[Bearbeiten] Keywords
and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq
[Bearbeiten] Beispiel
Das folgende Beispiel demonstriert die Verwendung von mehreren alternativen keywords:
Original:
The following example demonstrates the use of several alternative keywords:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
%:include <iostream> int main(int argc, char *argv<::>) <% if (argc > 1 and argv<:1:> not_eq '\0') <% std::cout << "Hello " << argv<:1:> << '\n'; %> %>