Lists Home |
Date Index |
Karl Waclawek scripsit:
> Maybe that is different for Java, but in general this is simply wrong.
If you mean "in C++", say so, not "in general". The IBM implementation
of Cobol made procedure calls very expensive, and most Cobol programmers
never wrote a subroutine throughout their careers, and only invoked them
for the sake of DBMS access, where they had no choice. That didn't make
procedure calls in general a bad idea.
> Apart from that they are expensive in most languages.
Expensive compared to what? If every procedure must return status, and
every caller must check the status and decide whether to itself return
status or carry on, your code size enlarges immensely and so does your
execution time. The alternative is to do what most C programmers do,
ignore status returns and carry on. We all know where that leads.
> And you have to trap them in your app, since you might not actually want to
> terminate the routine where the parse call returns to.
We were discussing the use of exceptions precisely to terminate parsing.
> Well, we (a group of programmers) ported SAX2 to Delphi.
> On Delphi the idea of using exceptions for regular program flow control
> is just not right. Same in C++.
You may be right: I don't know either C++ or Delphi particularly. But I
notice that Stroustrup took the trouble of making sure exceptions got into
C++, which means that he must think they are good for something.
> And like C++, Delphi is sometimes used for speed, meaning that
> one takes care about memory allocations. Exceptions are too
> expensive from that point of view, which matters if the program
> is meant to continue, and matters less if the current context has to
> be terminated.
It is well known that claims of efficiency and inefficiency mean nothing
unless backed up with numbers, for programmers' intuition on the subject
is notoriously in error.
John Cowan http://www.ccil.org/~cowan email@example.com
To say that Bilbo's breath was taken away is no description at all. There
are no words left to express his staggerment, since Men changed the language
that they learned of elves in the days when all the world was wonderful.