Sign in Join
Wiki copytemporary

Revision 1 of 3, by Kai Burghardt on 8-6-2022. The page as it is now.

&/pt

<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, o caractere de código decimal

pascal
38

(ou em [[Hexadecimal/pt|

pascal
$

]]

pascal
26

) é, por definição,

pascal
&

(chamado de “E comercial”).

Pascal

Base octal

Em Pascal o

pascal
&

denota um número em base octal.

pascal
program messageNo(input, output, stderr);

uses
    baseUnix;

begin
    // withdraw group write access to current terminal
    // equivalent to invoking: mesg n
    fpChmod('/dev/stdin', &0600);
end.

In an octal base only the characters

pascal
0

through and including

pascal
7

are allowed. An optional sign is specified in front of the

pascal
&

.

As a passing remark, in a production program the number in the above example is better written as

pascal
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.

Note: Literais numéricos em octal não são suportados pelos modos [[Mode Delphi/pt|

pascal
{$mode Delphi}

]] e [[Mode TP/pt|

pascal
{$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

pascal
&

as an escape character. Thus, without refactoring the code but escaping, i.e. prepending an

pascal
&

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

pascal
&

é usado para


From the Free Pascal wiki, page "&/pt", as it stood on 2022-08-06 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.