Alternative operator representations
来自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 + +(C),源代码可以写在任何非ASCII 7位字符集,其中包括ISO 646/ECMA-6不变的字符集。然而,一些C + +运算符和标点符号需要ISO 646的代码集之外的字符:
{, }, [, ], #, \, ^, |, ~。要能够使用字符编码的其中一些或所有的这些符号做不存在,Ç+ +定义两个种的替代品:额外的关键字对应的运营商使用这些字符和特殊组合的两个或三个的ISO 646兼容的字符进行解释的如果他们是一个单一的非ISO 646的性格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.
目录 |
[编辑] 替代关键字
有其他几家运营商的关键字在C + +标准定义为拼写.
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
|
[编辑] 的兼容性C
同样的话被定义在包含文件中<iso646.h>为宏在C编程语言。由于在C + +这些语言的关键字,C + +版本的<iso646.h>,以及<ciso646>,不定义任何东西.
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.
[编辑] 有向图和三字母
以下两个和三个字符的组合(有向图和三字母)替换为各自的主要特征是有效的
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} |
%> |
??>
|
[ |
<: |
??(
|
] |
:> |
??)
|
# |
%: |
??=
|
\ |
??/
| |
^ |
??'
| |
| |
??!
| |
~ |
??-
|
[编辑] 关键字
and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq
[编辑] 为例
下面的例子演示了如何使用几种可供选择的关键词
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'; %> %>

