Absolute/fi: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Absolute/fi
| Old | New | Line | |
|---|---|---|---|
| 1 | + | ` Absolute` [[modifier/fi|modifoija]] aiheuttaa [[Variable/fi|muuttujan]] tallentamisen samaan muistialueeseen kuin toinen muuttuja. | |
| 2 | + | ``` | |
| 3 | + | // Esimerkki little endian x64 prosessori | |
| 4 | + | Uses SysUtils; | |
| 5 | + | ||
| 6 | + | Var | |
| 7 | + | anInt : Integer; | |
| 8 | + | anotherInt : Integer absolute anInt; | |
| 9 | + | firstByte : Byte absolute anInt; | |
| 10 | + | ||
| 11 | + | begin | |
| 12 | + | // Kun molemmat integer-muuttujat ovat samassa muistipaikassa niin muutos heijastuu | |
| 13 | + | // myös toisessakin | |
| 14 | + | anInt := 20; | |
| 15 | + | ||
| 16 | + | WriteLn(IntToStr(anInt) + ' ' + IntToStr(anotherInt)); // Tulostuu: 20 20 | |
| 17 | + | ||
| 18 | + | // Lukuarvo 20 sopii tavun kokoiseen muistipaikkaan | |
| 19 | + | ||
| 20 | + | WriteLn('firstByte: ' + IntToStr(firstByte)); // Tulostuu: firstByte: 20 | |
| 21 | + | ||
| 22 | + | anotherInt := 333; | |
| 23 | + | ||
| 24 | + | WriteLn(IntToStr(anInt) + ' ' + IntToStr(anotherInt)); // Tulostuu: 333 333 | |
| 25 | + | ||
| 26 | + | // Luku 333 on liian iso sopiakseen tavun kokoiseen muistipaikkaan | |
| 27 | + | // little-endian x64 - vähiten merkitsevä tavu on ensimmäisenä muistissa: | |
| 28 | + | // 333 = 101001101 = 01001101 00000001 muistissa = $4D $01 = desimaalisena: 77 1 | |
| 29 | + | ||
| 30 | + | WriteLn('firstByte: ' + IntToStr(firstByte)); // Tulostuu: firstByte: 77 | |
| 31 | + | end. | |
| 32 | + | ``` | |
| 33 | + | ||
| 34 | + | --- | |
| 35 | + | *From the Free Pascal wiki, page "Absolute/fi", as the Internet Archive kept it on 2025-05-12. 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).* |
