In article <clc220luqib3h026tg1r7trfopcss9mebv@4ax.com>,
tom_usenet <tom_usenet@hotmail.com> wrote:
[color=blue]
> On Wed, 4 Feb 2004 11:01:18 -0700, "Jonathan Turkanis"
> <technews@kangaroologic.com> wrote:
>[color=green]
> >"tom_usenet" <tom_usenet@hotmail.com> wrote in message:
> >[color=darkred]
> >>
> >> Yes - their signature isn't conforming. However, it is difficult to
> >> detect this problem with conforming code, since you can't rely on[/color]
> >any[color=darkred]
> >> particular signature for non-virtual standard library member
> >> functions.[/color]
> >
> >Doesn't this do the trick?
> >
> > void f(std::map<int, int>& m)
> > {
> > std::map<int, int>::iterator it = m.begin();
> > if (it != m.end()) return m.erase(it);
> > }
> >
> >This should compile only if map::erase returns void.[/color]
>
> True, I hadn't thought of that, but who ever returns a void value from
> a void function? I suppose I should rephrase - it is unlikely that
> conforming code will ever be affected by the invalid return type, but
> it is possible.
>
> The problem is that Dinkumware doesn't want to break code written to
> one of their old, pre-standard libraries that also returned the
> iterator, but wasn't non-conforming since there was no standard to
> conform to.[/color]
Fwiw, this is LWG issue 130:
http://anubis.dkuug.dk/jtc1/sc22/wg2...ctive.html#130
Years ago it was voted as "not a defect" by the LWG. But the issue has
recently been reopened (at my request) in a new light: Ok, so it was an
intentional design decision for C++98. But for C++0X would it be better
to change the return type of these functions to iterator?
Several of the "NAD" defect reports are now being reexamined within the
context of C++0X.
-Howard