This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC] std::string(0);
On Fri, Jun 11, 2004 at 07:51:21PM +0200, Daniel Frey wrote:
> Martin Sebor wrote:
> >A conforming implementation is not allowed to reject constructs
> >such as std::string (0) just because they might cause undefined
> >behavior at runtime.
>
> OK, so this means we can't go the "easy" way. The remaining options are
> (AFAICS):
>
> a) Change the standard, make the above example illegal. Unlikely.
>
> b) Ask the compiler folks to detected these cases and emit a warning.
Reporting this usage at compile time would be a valuable service. (The
correct solution would have been to make that constructor explicit, but
we must choose our battles. Sigh.)
I propose
c) Report the error if the compiler was not invoked "-pedantic".
Nathan Myers
ncm-nospam@cantrip.org