If I missed anything important, please feel free to correct me. :-)
George <George@discussions.microsoft.com> wrote:
1.
memory on the stack. Local POD-style stack variables will be freed
gracefully even if an exception happens.
I assume it is implemented by a simple jmp assembly command to a
higher
memory address? Right?
No. jmp changes the flow of the code. It doesn't affect the stack.
Exception unwinding is more complicated than this.
2.
Any comments about why modern C++ library implements qsort in C, why
not
in
C++?
Because it is ridiculous to rewrite something that doesn't need
rewriting.
The qsort routine in C run-time libraries is well-established,
well-tested,
and well-optimized. The C++ run-time library needs EXACTLY the same
routine, with EXACTLY the same parameters and EXACTLY the same
semantics.
Why on earth wouldn't you use EXACTLY the same code?
(you see, almost all the libraries -- like STL algorithms -- are C++,
why
leaving qsort as a legacy C function?)
It's just not true. STL is C++, because it needs templates, but
"almost
all the libraries" is just not true.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.