Delphi 'absolute'

This is worth looking at, I think. :slight_smile: β†’ Delphi "absolute" keyword - Stack Overflow

You might argue this IMPROVES code correctness (and avoids ugly casting)

var
   Letter    : WideChar;              // 16 bit long
   CodePoint : Word absolute Letter;  // also 16 bit long
begin
   CodePoint:= $30c4;  // Katakana "Tu"   
// Letter automatically becomes 'ツ' 

   Letter:= 'И';  // Cyrillic "I"
// Codepoint automatically becomes $0418

procedure LabelClick(Sender : TObject);
var
    lbl : TLabel ABSOLUTE Sender;
begin
    if sender is Tlabel then begin
       // use lbl.caption vs TLabel(Sender).caption
    end;
end;
2 Likes

I use it occasionally - it’s useful to overlay a record over integer types to enable working with individual bytes/words etc.

1 Like