Incompatible type of std::imag function

Paolo Carlini pcarlini@suse.de
Wed Feb 1 09:29:00 GMT 2006


Gene Novark wrote:

> Any thoughts?

Sure. To tell you the truth, I really noticed the issue only recently,
when implementing part of tr1/complex and learned that there is an open DR:

    http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#387

and a paper:

    http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1589.html

Upon a quick check, it looks like knowledgeable people agree that this
is a real defect and that the solution adopted in v3 is better than the
letter of the current standard, at least (*).

As a very general observation - probably you are already aware of this -
even if we wanted to change such functions (real, imag), we couldn't do
that without breaking the binary compatibility, because only the return
type would be different.

Paolo.

(*) Note, however, that now that TR1 is out, setters seem slightly
better from the point of view of consisteny with TR1, 8.1.9: the
additional overloads cannot return by reference.



More information about the Libstdc++ mailing list