Delphi Error – E2118 Division by zero

Delphi Compiler Error

E2118 Division by zero

Reason for the Error & Solution

The inline assembler has encountered an expression which results in a division by zero.

program Produce;

  procedure AssemblerExample;
  asm
    dw  1000 / 0
  end;

begin
end.

If you are using program constants instead of constant literals, this error might not be quite so obvious.

program Solve;

  procedure AssemblerExample;
  asm
    dw  1000 / 10
  end;

begin
end.

The solution, as when programming in high-level languages, is to make sure that you don’t divide by zero.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error E2313 Attribute – Known attribute cannot specify properties Reason for the Error & Solution No further information...
Delphi Compiler Error E2379 Virtual methods not allowed in record types Reason for the Error & Solution No further information...
Rodrigo , one of the long time Delphi Developer has been working on one of his personal project “Delphi IDE...