Boost logo

Boost Users :

From: Daryle Walker (darylew_at_[hidden])
Date: 2007-08-27 11:05:39


Ewgenij Sokolovski wrote:
[SNIP]
> http://www.boost.org/libs/test/doc/components/execution_monitor/index.html#caught_exception
>
> So, I can use a C string for my exception.
>
> I have written a small example test case and included throwing of an uncaught
> exception
> in it:
>
> try{
> throw "blub";
> }
> catch(char* ex){
> throw;
> }
>
> As I started the testing process I didn't get a "blub"-Exception message, but
>
> Boost.Test internal framework error: unknown reason
>
> So, what's wrong? Why is "blub" not reported as "blub"? Can anybody explain that?

Maybe "blub" was interpreted as "char[5]" or "char const *" instead of
"char *". At least the first alternate choice is incompatible with
"char *" as far as exception type matching is concerned. (The C family
of languages is broken in that it treats arrays as pointers with funny
settings. And even that breakage is broken because it uses that
treatment only 90% of the time; the other 10% of uses treat arrays and
pointers differently [e.g. extern], and you probably found one of them.)

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net