Difference between revisions of "&/pt"
(Created page with "{{&}} <div style="float:left; margin: 0 25px 20px 0; padding:40px; font-size:500%; font-family: Georgia; background-color: #f9f9f9; border: 2px solid #777777;">&</div> Em AS...") |
|||
Line 1: | Line 1: | ||
{{&}} | {{&}} | ||
<div style="float:left; margin: 0 25px 20px 0; padding:40px; font-size:500%; font-family: Georgia; background-color: #f9f9f9; border: 2px solid #777777;">&</div> | <div style="float:left; margin: 0 25px 20px 0; padding:40px; font-size:500%; font-family: Georgia; background-color: #f9f9f9; border: 2px solid #777777;">&</div> | ||
− | Em [[ASCII/pt|ASCII]], o caractere de código decimal <syntaxhighlight lang="pascal" | + | Em [[ASCII/pt|ASCII]], o caractere de código decimal <syntaxhighlight lang="pascal" inline>38</syntaxhighlight> (ou em [[Hexadecimal/pt|<syntaxhighlight lang="pascal" inline>$</syntaxhighlight>]]<syntaxhighlight lang="pascal" inline>26</syntaxhighlight>) é, por definição, <syntaxhighlight lang="pascal" inline>&</syntaxhighlight> (chamado de “E comercial”). |
== Pascal == | == Pascal == | ||
=== Base octal === | === Base octal === | ||
− | Em [[Pascal/pt|Pascal]] o <syntaxhighlight lang="pascal" | + | Em [[Pascal/pt|Pascal]] o <syntaxhighlight lang="pascal" inline>&</syntaxhighlight> denota um número em base octal. |
<syntaxhighlight lang="pascal" line highlight="9"> | <syntaxhighlight lang="pascal" line highlight="9"> | ||
program messageNo(input, output, stderr); | program messageNo(input, output, stderr); | ||
Line 18: | Line 18: | ||
end. | end. | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | In an octal base only the characters <syntaxhighlight lang="pascal" | + | In an octal base only the characters <syntaxhighlight lang="pascal" inline>0</syntaxhighlight> through and including <syntaxhighlight lang="pascal" inline>7</syntaxhighlight> are allowed. |
− | An optional sign is specified in front of the <syntaxhighlight lang="pascal" | + | An optional sign is specified in front of the <syntaxhighlight lang="pascal" inline>&</syntaxhighlight>. |
As a passing remark, in a production program the number in the above example is better written as | As a passing remark, in a production program the number in the above example is better written as | ||
Line 34: | Line 34: | ||
=== Caractere de escape === | === Caractere de escape === | ||
[[FPC|FreePascal]] retroactively declared some new [[Reserved word|reserved words]]. | [[FPC|FreePascal]] retroactively declared some new [[Reserved word|reserved words]]. | ||
− | In order of being capable of compiling old code with an up-to-date [[Compiler|compiler]] version, which might fail due to those new reserved words, FPC declared the <syntaxhighlight lang="pascal" | + | In order of being capable of compiling old code with an up-to-date [[Compiler|compiler]] version, which might fail due to those new reserved words, FPC declared the <syntaxhighlight lang="pascal" inline>&</syntaxhighlight> as an escape character. |
− | Thus, without refactoring the code but escaping, i.e. prepending an <syntaxhighlight lang="pascal" | + | Thus, without refactoring the code but escaping, i.e. prepending an <syntaxhighlight lang="pascal" inline>&</syntaxhighlight> to the [[Identifier|identifier]], the compiler accepts the actual reserved word as a valid identifier. New code though shall come up with different identifier names, without utilizing this feature. |
== Lazarus == | == Lazarus == | ||
− | No [[Lazarus/pt|Lazarus]] o <syntaxhighlight lang="pascal" | + | No [[Lazarus/pt|Lazarus]] o <syntaxhighlight lang="pascal" inline>&</syntaxhighlight> é usado para |
− | * indicar teclas de atalho em [[TMenuItem|<syntaxhighlight lang="pascal" | + | * indicar teclas de atalho em [[TMenuItem|<syntaxhighlight lang="pascal" inline>TMenuItem</syntaxhighlight>]] |
{{Symbols}} | {{Symbols}} |
Latest revision as of 17:11, 6 August 2022
│
English (en) │
suomi (fi) │
français (fr) │
português (pt) │
русский (ru) │
Em ASCII, o caractere de código decimal 38
(ou em $
26
) é, por definição, &
(chamado de “E comercial”).
Pascal
Base octal
Em Pascal o &
denota um número em base octal.
1program messageNo(input, output, stderr);
2
3uses
4 baseUnix;
5
6begin
7 // withdraw group write access to current terminal
8 // equivalent to invoking: mesg n
9 fpChmod('/dev/stdin', &0600);
10end.
In an octal base only the characters 0
through and including 7
are allowed.
An optional sign is specified in front of the &
.
As a passing remark, in a production program the number in the above example is better written as
fpChmod('/dev/stdin', S_IRUSR or S_IWUSR);
since it is more meaningful than having a raw number. Pascal is a high-level language. Use this advantage. Write what you mean, not what in fact the computer does.
{$mode Delphi}
e {$mode TP}
.Caractere de escape
FreePascal retroactively declared some new reserved words.
In order of being capable of compiling old code with an up-to-date compiler version, which might fail due to those new reserved words, FPC declared the &
as an escape character.
Thus, without refactoring the code but escaping, i.e. prepending an &
to the identifier, the compiler accepts the actual reserved word as a valid identifier. New code though shall come up with different identifier names, without utilizing this feature.
Lazarus
No Lazarus o &
é usado para
- indicar teclas de atalho em
TMenuItem
single characters |
|
character pairs |
|