Sign in Join
Wiki copytemporary

Revision 1 of 2, by WikiArchive on 11-4-2026. The page as it is now.

Absolute/fi

Absolute modifoija aiheuttaa muuttujan tallentamisen samaan muistialueeseen kuin toinen muuttuja.

pascal
// 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 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.