[Please do not mail me a copy of your followup]
fl <
rxj...@gmail.com> spake the secret code
<
9d409917-64a3-480c...@googlegroups.com> thusly:
> Could you explain it to me on this throw usage?
Seriously, what book are you guys getting all this really confusing
code from?
> void swap (Number &n) throw ();
This is an exception specification, which you can read about here:
<
http://en.cppreference.com/w/cpp/language/except_spec>
This is deprecated since C++11 -- in other words for almost 5 years,
it has been recommended that you NOT USE THIS.
Why is this the recommendation? Because exception specifiers are an
idea borrowed from Java and they ended up causing more problems in C++
than they solved because C++ is not Java ;-).[*]
The intention with the 'throw()' exception specification is to say that
this function does not throw. This is the one useful thing that
exception specifications gave C++ and the reason why C++11 introduced
the noexcept keyword, which should be used instead:
<
http://en.cppreference.com/w/cpp/language/noexcept_spec>
[*] This is my opinion. But seriously, this is usenet; do I really have
to qualify anything in my posts as my opinion? Whose opinion would be
if it wasn't mine?
--
"The Direct3D Graphics Pipeline" free book <
http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <
http://computergraphicsmuseum.org>
The Terminals Wiki <
http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <
http://legalizeadulthood.wordpress.com>