Absolute/fi
Deutsch · English · Español · Français · Suomi · Русский
Absolute modifoija aiheuttaa muuttujan tallentamisen samaan muistialueeseen kuin toinen muuttuja.
// Esimerkki little endian x64 prosessori
Uses SysUtils;
Var
anInt : Integer;
anotherInt : Integer absolute anInt;
firstByte : Byte absolute anInt;
begin
// Kun molemmat integer-muuttujat ovat samassa muistipaikassa niin muutos heijastuu
// myös toisessakin
anInt := 20;
WriteLn(IntToStr(anInt) + ' ' + IntToStr(anotherInt)); // Tulostuu: 20 20
// Lukuarvo 20 sopii tavun kokoiseen muistipaikkaan
WriteLn('firstByte: ' + IntToStr(firstByte)); // Tulostuu: firstByte: 20
anotherInt := 333;
WriteLn(IntToStr(anInt) + ' ' + IntToStr(anotherInt)); // Tulostuu: 333 333
// Luku 333 on liian iso sopiakseen tavun kokoiseen muistipaikkaan
// little-endian x64 - vähiten merkitsevä tavu on ensimmäisenä muistissa:
// 333 = 101001101 = 01001101 00000001 muistissa = $4D $01 = desimaalisena: 77 1
WriteLn('firstByte: ' + IntToStr(firstByte)); // Tulostuu: firstByte: 77
end.From the Free Pascal wiki, page "Absolute/fi", 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.
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
