◐ Shell
clean mode source ↗

Alternative operator representations - cppreference.com

De cppreference.com

<metanoindex/>

C + + (e C) código-fonte pode ser escrito em qualquer conjunto de caracteres não-ASCII 7-bit, que inclui o conjunto de caracteres ISO 646/ECMA-6 invariante. No entanto, vários operadores C + + e Punctuators exigem caracteres que estão fora do ISO 646 codeset: {, }, [, ], #, \, ^, |, ~. Para ser capaz de utilizar a codificação de caracteres em que alguns ou todos estes símbolos não existem, C + + define dois tipos de alternativas: as palavras-chave adicionais que correspondem aos operadores que utilizam esses caracteres e combinações específicas de dois ou três ISO 646 caracteres compatíveis que são interpretados como se fossem um único não-ISO 646 caracteres.

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.

Palavras-chave alternativas

Há grafias alternativas para vários operadores definidos como palavras-chave em C + + padrão.

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.

Primary Alternative
&& and
&= and_eq
& bitand
| bitor
~ compl
! not
!= not_eq
|| or
|= or_eq
^ xor
^= xor_eq

Compatibilidade com C

As mesmas palavras são definidas na linguagem de programação C na <iso646.h> arquivo de inclusão como macros. Porque em C + + são expressões linguísticas, o C + + versão <iso646.h>, bem como <ciso646>, não define qualquer coisa.

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.

Dígrafos e trigraphs

As seguintes combinações de duas e três caracteres (dígrafos e trigraphs) são substituições válidos para seus respectivos personagens principais:

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.

Primary Digraph Trigraph
{ <% ??<
None} %> ??>
[ <: ??(
] :> ??)
# %: ??=
\ ??/
^ ??'
| ??!
~ ??-

Palavras-chave

and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor, xor_eq

Exemplo

O exemplo seguinte demonstra o uso de palavras-chave várias alternativas:

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.

%:include <iostream>

int main(int argc, char *argv<::>) 
<%
    if (argc > 1 and argv<:1:> not_eq '\0') <%
        std::cout << "Hello " << argv<:1:> << '\n';
    %>
%>