Fandom

Delphi Programming

Assert

2,919pages on
this wiki
Add New Page
Talk0 Share
in "Option|Project|Directories/Conditionals"
in "Conditional": DEBUG
interface
{$ifDEF DEBUG} {$D+} {$else} {$D-} {$endIF}
procedure...
begin
..
  {$ifOPT D+}Assert(n>1, 'n>1');{$endIF}
..
end;
PROCEDURE Assert(Cond: boolean; const Msg: string);
var
  progSeg,
  progOfs: word;
begin
  asm
      mov ax, [bp+04]            
      mov es, ax
      mov ax, word ptr es:0      
      mov progSeg, ax            
      mov ax, [bp+02]
      mov progOfs, ax            
  end;

  if (Cond = FALSE) then begin
    mmDebug.Lines.Add(Msg + ' at location ' +
                              IntToHex(progSeg, 4) +':' +IntToHex(progOfs, 4) );
    ShowModal;
  end;
end;

--NNN nmanca 20:10, 13 August 2008 (UTC)

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki