Mail Archives: djgpp/1998/06/18/11:19:15
> > If you really want to program with exceptions, use a language
> > where they are defined as standard and work: Ada. GNAT Ada 95 for
> > DOS uses DJGPP 2.01 as back-end and exceptions _do_ work !
>
> I like C++ and exceptions ARE a standard in the language, so I don't
> see what the big deal is.
It isn't that I dislike C++. But maybe is the standard too fresh ? Exceptions
should work as well as loops in any compiler. The advantage in Ada is that
exceptions are among the basic structures of the language, from the 1st version.
Examples:
1)
begin
(...)
if A_sym then -- LtL (Cholesky), cas symetrique
DPBTRF(upper, N=> nb_eq_2, KD=> lda-1, AB=> AB, LDAB=> lapmax);
else -- LU
DGBTRF(M=> nb_eq_2,N=> nb_eq_2, KL=> lda-1, KU=>lda-1,
AB=> AB, LDAB=> lapmax, IPIV=> pivots);
end if;
exception
when Computation_error=> Put("pivot 0, ligne / mineur <0 d'ordre");
Put(info); raise; -- re-raise Computation_error after message
end;
2)
begin
(...)
exception
when Out_Of_Range | Out_Of_Buffer_Range => null; -- SVGA
end;
--
Gautier
--------
Homepage: http://www.unine.ch/math/Personnel/Assistants/Gautier/Montmollin.html
Software: http://www.unine.ch/math/Personnel/Assistants/Gautier/Gaut_FTP.htm.
- Raw text -