Integer division by zero results in floating-point exception

Dan murpsoft at hotmail.com
Tue Apr 3 12:44:13 PDT 2007


The x86 architecture will perform either a fault or a trap when the instruction DIV or MOD is used, and the second operand is a 0.  A fault or a trap, is when it ceases execution and instead executes:

function* IDT[0x??], which is the divide by zero handler for the system.  Each operating system has to write their own handler, and it's often just a "throw an error to the command line, durr".

Faults stop before the instruction, Traps stop after, or the other way around.  Can't remember.


More information about the Digitalmars-d-learn mailing list