This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] std::string(0);


Martin Sebor wrote:
Daniel Frey wrote:

b) Ask the compiler folks to detected these cases and emit a warning.
Bonus points for suppressing the warning on dead code branches like above. Sadly, I suppose it's ways more work than adding one or two lines to the STL implementation. Any volunteers? ;)

I don't think this would work, either. The compiler may not be able to tell whether a branch of code is dead or not. Consider this:

     #include <string>
     int main (int argc, char**) {
         if (argc > 1) std::string (0);
     }

Martin

That's why it should be a warning, not an error. I think it's very likely that std::string(0) is an error, remember my original example of a parameter. Question is, which compiler options invoke the warning.


Regards, Daniel

--
Daniel Frey

aixigo AG - financial solutions & technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey@aixigo.de, web: http://www.aixigo.de



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]