Re: divide by zero error

new topic     » goto parent     » topic index » view thread      » older message » newer message

Look this is just a problem of what should be done with non-sense calls or expressions:

  • return an error code using the classical return found in everywhere or exception mechanism seen in java and c++?
  • crash the program?
  • signal an error at compile time if possible first then one of the former two if not?

They all have their advantages. I'm with you though, return an error code let the caller handle the exception with the modification of the third option above. Either way you need to check something: For the crash strategy it is before each call for bad inputs and in the return policy it can be after several calls for nonsensible outputs.

Shawn Pringle

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu