Sign in Join
Wiki copytemporary

&/pt: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
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;">
2-
31&
4-
5-</div>
62
73Em [[ASCII/pt|ASCII]], o caractere de código decimal `38` (ou em [[Hexadecimal/pt|$]]`26`) é, por definição, `&` (chamado de “E comercial”).
84
95## Pascal
106
117### Base octal
128
139Em [[Pascal/pt|Pascal]] o `&` denota um número em base octal.
1410
1511``` pascal
1612program messageNo(input, output, stderr);
1713
1814uses
1915 baseUnix;
2016
2117begin
2218 // withdraw group write access to current terminal
2319 // equivalent to invoking: mesg n
2420 fpChmod('/dev/stdin', &0600);
2521end.
2622```
2723
2824In an octal base only the characters `0` through and including `7` are allowed. An optional sign is specified in front of the `&`.
2925
3026As a passing remark, in a production program the number in the above example is better written as
3127
3228``` pascal
3329fpChmod('/dev/stdin', S_IRUSR or S_IWUSR);
3430```
3531
3632since 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.
3733
3834> **Note:** Literais numéricos em octal não são suportados pelos modos [[Mode Delphi/pt|{$mode Delphi}]] e [[Mode TP/pt|{$mode TP}]].
3935
4036### Caractere de escape
4137
4238[[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 `&` as an escape character. Thus, without refactoring the code but escaping, i.e. prepending an `&` 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.
4339
4440## Lazarus
4541
4642No [[Lazarus/pt|Lazarus]] o `&` é usado para
4743
4844- indicar teclas de atalho em [[TMenuItem]]
4945
5046---
5147*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](/wiki-contact).*

Back to history