:: Re: [DNG] another programming langu…
Page principale
Supprimer ce message
Répondre à ce message
Auteur: Didier Kryn
Date:  
À: dng
Sujet: Re: [DNG] another programming language question
Le 25/10/2024 à 13:24, karl@??? a écrit :
> If you enclose more than a few lines of code in a try block, then you
> will loose the sense of where it happened.


    Why would'nt you know where it happened?

    In C you have errno to tell you what happened, and not all
functions have the same possible errors. In Ada, the exception not only
has a name, it also contains the place it occured and, AFAIR you can
tell which line of code caused it.

    In general, for exceptions related to programming errors, you
prefer to let the program crash and tell you why,  and then correct the
bug. Exception handling is most usefull for the errors detected by your
own logic, like protocol errors in a dialog between applications. It is
very convenient to not mix exception handling and normal program
behaviour. You can declare as many different exceptions as you need;
therefore, there is no problem to know where and and why they happen.

--     Didier