Re: [Quickfix-developers] r1491: nasty bug in Exception class
Brought to you by:
orenmnero
|
From: Oren M. <or...@qu...> - 2006-06-02 22:20:48
|
Argh. You do pay a price for coding too late into the night. Interestingly enough this did not crash under windows. --oren On Jun 2, 2006, at 4:36 PM, Caleb Epstein wrote: > QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/ > html/index.html > QuickFIX Support: http://www.quickfixengine.org/services.html > > The Exception class constructor has a nasty bug. Can you spot it? > > /// Base QuickFIX exception type. > struct Exception : public std::logic_error > { > Exception( const std::string& t, const std::string& d ) > : std::logic_error( detail.size() ? t + ": " + d : t ), > type( t ), detail( d ) > {} > > std::string type; > std::string detail; > }; > > > > > > > > > > > > > > > > SPOILER: > > The ternary operator is using the "detail" class member, but it hasn't > been constructed yet! Boom! > > -- > Caleb Epstein > > > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers > |