Re: [Cppunit-devel] Dazed and confused a 15 char string breaks cppunit
Brought to you by:
blep
From: Baptiste L. <gai...@fr...> - 2002-06-21 11:31:50
|
----- Original Message ----- From: "Philippe Lavoie" <phi...@ca...> To: "Cpp Unit Develpment Mailing List" <cpp...@li...> Sent: Thursday, June 20, 2002 6:48 PM Subject: [Cppunit-devel] Dazed and confused a 15 char string breaks cppunit > > > > Hi all, > > > The following assert works in every project I tested > CPPUNIT_ASSERT_MESSAGE("012345678901234",true); This will call the function of Asserter indicated below, which makes a std::string out of the message. In 1.9.8, this string will be used as the first detail string of a Message, in earlier version, it will be passed to Exception constructor (what version are you using ?) void failIf( bool shouldFail, std::string message, SourceLine &sourceLine = SourceLine() ); > The following assert works in every project I tested except mine... > CPPUNIT_ASSERT_MESSAGE("0123456789012345",true); > > When it breaks... it breaks, it does an assertion error. I really have no > idea what is going on. I've checked the properties for my project, vs the > properties for projects that work without problems and I can't find what is > different. I can't find a different define. I can't find any substantical > differences. Could you provide the call stack ? I really don't see where this could come from (AFAIK, CppUnit don't use any fixed length buffer). The 15 limits sound a lot like a old VC 5 STL bug (there was an issue with 32 characters length string). Though, it would be odd that such a bug occurs in a newer version of STL... I tried to reproduce the problem by adding the assertion in a few of my projects (VC 6 SP5, CppUnit CVS version), but did not succeed. > The only clue I have about the problem is that the following warning only > shows for my project and > > doesn't show for any other projects. Hmm, I'm not sure if those warning are really the cause. It indicates that the template implementation is not exported in the DLL (std::string is a template). This is not usually an issue since the template is implemented in the user project. What is really odd is that the std::string template is supposed to be exported by the STL (at the end of the 'string' header, you can find those 'extern template...' which do that, at least, in VC 6). It sound like as if the wrong version of the runtime library was being used... > > c:\build\Include\cppunit\SourceLine.h(51) : warning C4251: > 'CppUnit::SourceLine::m_fileName' : class > 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be > used by clients of class 'CppUnit::SourceLine' [...] > > Please Help > > Phil > > PS I'm using VS7.0 --- Baptiste Lepilleur <gai...@fr...> http://gaiacrtn.free.fr/ |