Bisma Jayadi wrote:
> Hi all...
> 
> I've always been confused about this subject... flag or exception for
> error handling? Can anyone share knowledges and ideas about when and
> where and why a (pascal) developer should chose one over another?

Depends on taste, and they have both advantages and disadvantages.

For example, it's easy to see when flag-using code is coded correctly
(are the return values checked and handled?), while it's hard for
exception-using code. Exceptions are usually slower as well. Exceptions
are also not compatible to other languages, usually. OTOH, using
exceptions is lazier/easier. If an error should never occur, then using
exceptions will have more readable code, as not every function calling
this must handle the possible error flag.

Micha
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to