where the exception goes is well defined, it cannot go somewhere, it goes
simply down the callstack which is more readable than gotos, imo.
"Simply down the callstack" is a bit of an oxymoron - this has some
severe and rather complicated consequences in case the callstack that is
being partially pop()ed contains partially executed
constructor/destructor calls, for example. Of course it is possible to
handle this properly, my only point is that it is complicated. Too
complicated for me, anyway - but of course you may be one of that rare
breed of programmers that understands what is going on in these cases.
If so: congratulations, and more power to you!
The nice thing about exceptions is that the code throwing it shouldn't
care who catches it. This does not blend well with my preferred way of
working where I can keep track of the execution flow. Subjective.
Exception handling in C++ can result in code that is significantly
bloated and slower, by the way. The C++ compiler needs to insert
instrumentation code to handle exceptions in any function that can
possibly be the target of an exception, as far as I understand.
but doesn't c support structured exception handling too? i heard something
like that.
Not that I'm aware of. You do have setjmp/longjmp which allows to
effectively save and restore the stack state, and this can be used to
implement something similar, but that's it, as far as I know.
that is not true. name me one example where semantics are different on
different compilers!
My latest try on doing something with templates was with a C++ compiler
for a Trimedia embedded processor, which failed to compile a rather
simple program with a template class, giving me an internal compiler
error. (this was about 2 years ago when I was graduating - can't
reproduce the program I'm afraid). Back in those days, compilers were
rife with problems in their template implementations.
I just did a search on Google for recent reports on this and (apart from
some rants on VC++ 6.0 templates), I get relatively little results.
Perhaps people have cleaned up their act (I don't know), so I guess it's
only fair to retract this statement since I cannot back it up with
anything other than old experience. My apologies... I just hope somebody
could step in at this point and give a couple of relevant examples to
prove me right after all.
templates are a very very useful and mighty feature in c++. however it is a
bit difficult to use.
On that we agree.
yes and no. c++ should not be used for everything. gui's should not be made
with c++.
Fact is that a very large percentage of GUIs _is_ made with C++.
for libraries, c++ is good because it is very fast and flexible thanks to
templates.
Except that it is difficult to link such a library with proprietary
software - these usually only support linking to C code. This severely
limits the usefulness of such libraries.
you say the language design has failed, but do you have a better idea how it
can be solved?
No. I'm waiting for people smarter than I am to come up with a new
paradigm
imo for high performance applications there is no better way than c++. since
c lacks of templates, c++ would be the choice for me.
I'm comfortable with that. People differ, that's generally a good thing.
I haved C++ also on occasion, for a rather small self-contained data
processing application that just cried out for a (simple) class
hierarchy. It depends a lot on the type of project, I suppose.
right i cannot imagegine that somebody really and completely understands the
STL.
Oh I can imagine that. I just hope these people don't expect the same of me!
Best regards, Sidney