&/pt: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 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 | 2 | ||
| 3 | 3 | & | |
| 4 | 4 | ||
| 5 | 5 | </div> | |
| 6 | 6 | ||
| 7 | - | ||
| 8 | - | ||
| 9 | - | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - | ||
| 28 | - | ||
| 29 | - | ||
| 30 | - | ||
| 31 | - | ||
| 7 | + | Em [[ASCII/pt|ASCII]], o caractere de código decimal `38` (ou em [[Hexadecimal/pt|$]]`26`) é, por definição, `&` (chamado de “E comercial”). | |
| 32 | 8 | ||
| 33 | 9 | ## Pascal | |
| 34 | 10 | ||
| 35 | 11 | ### Base octal | |
| 36 | 12 | ||
| 37 | - | ||
| 38 | - | ||
| 39 | - | ||
| 40 | - | ||
| 41 | - | ||
| 42 | - | ||
| 43 | - | ||
| 13 | + | Em [[Pascal/pt|Pascal]] o `&` denota um número em base octal. | |
| 44 | 14 | ||
| 45 | 15 | ``` pascal | |
| 46 | 16 | program messageNo(input, output, stderr); | |
| 47 | 17 | ||
| 48 | 18 | uses | |
| 49 | 19 | baseUnix; | |
| 50 | 20 | ||
| 51 | 21 | begin | |
| 52 | 22 | // withdraw group write access to current terminal | |
| 53 | 23 | // equivalent to invoking: mesg n | |
| 54 | 24 | fpChmod('/dev/stdin', &0600); | |
| 55 | 25 | end. | |
| 56 | 26 | ``` | |
| 57 | 27 | ||
| 58 | - | ||
| 59 | - | ||
| 60 | - | ||
| 61 | - | ||
| 62 | - | ||
| 63 | - | ||
| 64 | - | ||
| 65 | - | ||
| 66 | - | ||
| 67 | - | ||
| 68 | - | ||
| 69 | - | ||
| 70 | - | ||
| 71 | - | ||
| 72 | - | ||
| 73 | - | ||
| 74 | - | ||
| 75 | - | ||
| 76 | - | ||
| 28 | + | In an octal base only the characters `0` through and including `7` are allowed. An optional sign is specified in front of the `&`. | |
| 77 | 29 | ||
| 78 | 30 | As a passing remark, in a production program the number in the above example is better written as | |
| 79 | 31 | ||
| 80 | 32 | ``` pascal | |
| 81 | 33 | fpChmod('/dev/stdin', S_IRUSR or S_IWUSR); | |
| 82 | 34 | ``` | |
| 83 | 35 | ||
| 84 | 36 | 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. | |
| 85 | 37 | ||
| 86 | - | ||
| 87 | - | ||
| 88 | - | ||
| 89 | - | ||
| 90 | - | ||
| 91 | - | ||
| 92 | - | ||
| 93 | - | ||
| 94 | - | ||
| 95 | - | ||
| 96 | - | ||
| 97 | - | ||
| 98 | - | ||
| 38 | + | > **Note:** Literais numéricos em octal não são suportados pelos modos [[Mode Delphi/pt|{$mode Delphi}]] e [[Mode TP/pt|{$mode TP}]]. | |
| 99 | 39 | ||
| 100 | 40 | ### Caractere de escape | |
| 101 | 41 | ||
| 102 | - | ||
| 103 | - | ||
| 104 | - | ||
| 105 | - | ||
| 106 | - | ||
| 107 | - | ||
| 108 | - | ||
| 109 | - | ||
| 110 | - | ||
| 111 | - | ||
| 112 | - | ||
| 113 | - | ||
| 114 | - | ||
| 42 | + | [[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. | |
| 115 | 43 | ||
| 116 | 44 | ## Lazarus | |
| 117 | 45 | ||
| 118 | - | ||
| 119 | - | ||
| 120 | - | ||
| 121 | - | ||
| 122 | - | ||
| 123 | - | ||
| 124 | - | ||
| 125 | - | ||
| 126 | - | ||
| 127 | - | ||
| 128 | - | ||
| 129 | - | ||
| 46 | + | No [[Lazarus/pt|Lazarus]] o `&` é usado para | |
| 130 | 47 | ||
| 131 | - | ||
| 48 | + | - indicar teclas de atalho em [[TMenuItem]] | |
| 132 | 49 | ||
| 133 | 50 | --- | |
| 134 | 51 | *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).* |
