Συντάκτης: karl
Ημερομηνία:
Προς: dng
Αντικείμενο: Re: [DNG] C exception handling
Didier:
> Le 29/10/2024 à 21:15, karl@??? a écrit :
...
> > The are no "exceptions" in C so it cannot propagate them, I guess you
> > mean various error conditions, handled in C with return/parameter values
> > at the return of a function/subroutine or by a signal.
>
> Â Â Â That's exactly the point. In Ada or C++, you can decide that a
> situation is /exceptional/ and you want to process it in a different
> logical flow than the /normal/ one, either in the same subprogram, or
...
There is one thing you have to keep in mind, whatever programming
language you are useing, use its strength and avoid its pitfalls.
So, don't try to mimic ADA in C, don't mimic C in fortran, etc.
If you need things that are ADA's strong points, then you should use ADA,
if you need things that are C's strong points, then you should use C.
Use the best language at hand you master.
> Â Â Â If you have a look at setjmp/longjmp, you'll see its main use case
> deals exactly with that problem, but it is delicate to use.
As (I think it was) Kevin wrote, don't use longjmp.
> Â Â Â My current work is a parser for the web client request and MIME
...
In a parser it is normal to get bogus input, it isn't exceptional.
A parser that gives you intelligent responses is something to strive
for.
Regards,
/Karl Hammar