Boost logo

Boost :

From: Kevlin Henney (kevlin_at_[hidden])
Date: 2001-10-06 07:17:25


> From: Beman Dawes <bdawes_at_[hidden]>
>
>At 06:08 PM 10/4/2001, williamkempf_at_[hidden] wrote:
>
> >It can be argued, though, that I didn't do anything "nonportable".
> >I've included all the relevant headers according to the requirements
> >of the standard with one viewpoint on this. Technically I haven't
> >since I inderectly used std::string by calling the std::exception
> >type's constructor, but then we come back to wondering if the design
> >of the std::exception types are broken. I *truly* don't think it's
> >unreasonable to expect that I shouldn't have to explicitly include
> ><string> when I construct a std::exception type if I never use
> >std::string myself. I don't really care if <exception> includes
> ><string> or not, so long as I don't have to do so myself when I never
> >use std::string. There's two ways to do this right in my mind:
> >either <exception> must include <string> or all std::exception types
> >need to have overloaded constructors that take const char* parameters.

I've missed the earlier part of this thread, so sorry if I misunderstand
what you have written here. However, there is no dependency in the
standard between <exception> and <string>: std::exception has no
specified members that depend on std::string, so it sounds like there
may indeed be some non-portability afoot.

>Maybe you ought to write up a defect report. It will be easier for the LWG
>to understand the issue if you boil it down to a very simple piece of code
>that you want to know is or isn't conforming.
>
>Let's see. Something like this:
>
> #include <stdexcept>
>
> class lock_error : public std::runtime_error
> {
> public:
> lock_error() : std::runtime_error("thread lock error") { }
> };
>
> Is this conforming code? Note the lack of #include <string>,
> that std::runtime_error() takes a const string& argument, and
> there is no constructor taking a const char*.
>
>Post it on comp.std.c++ with a subject that begins "Defect Report:"

I believe that this issue (between <stdexcept> and <string>) is a known
problem, although I don't know if it's yet a DR. It has at least been
mentioned in passing by myself, Howard Hinnant and a couple of others at
one or other of the ISO meetings in the last year (and the cyclic
dependency problem was also the basis for a general solution I wrote up
in http://www.cuj.com/experts/1911/henney.htm).

Kevlin
____________________________________________________________

  Kevlin Henney phone: +44 117 942 2990
  mailto:kevlin_at_[hidden] mobile: +44 7801 073 508
  http://www.curbralan.com fax: +44 870 052 2289
  Curbralan: Consultancy + Training + Development + Review
____________________________________________________________


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk