|
Boost : |
From: William E. Kempf (wekempf_at_[hidden])
Date: 2003-01-14 23:51:20
Beman Dawes said:
> At 03:29 PM 1/13/2003, David Abrahams wrote:
>
> >Remember that it's a bad idea to carry dynamically-allocated state in
> an exception object.
>
> I wrestled with that a long time with the Filesystem Library, and
> finally ignored it. The advice is good in general, but there just
> didn't seem to be any way to meet the needs of users without carrying
> several paths (which contain std::strings.)
Might be true for Boost.Filesystem. The path values may be useful in some
cases, for instance. I'm not 100% sure about the who() string, though.
> > Translating to readable strings at the throw
> >point is ill-advised.
>
> Operating systems provide useful information (error descriptions
> translated into the local language, for example) which are easy to
> supply as readable strings as part of the exception, and hard for users
> to supply (because the user code would be non-portable). Thus the
> filesystem exceptions supply a nice, ready-to-use, what() message.
But the what() message can be constructed at the time it's called, instead
of at the time the exception is generated.
William E. Kempf
wekempf_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk