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