RE: basic_string causes crash in _vsnprintf???
- From: WXS <WXS@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 24 Jun 2005 05:05:01 -0700
I wanted to thank everyone for the thoughts and ideas on this topic.
I was able to get our code running to some extent by fixing the strings to
call c_str() in only a few places but I'm sure I am leaving time bombs in the
code at this point so we'll probably run in the current mode for nowand
consider a replacement class or test the heck out of the thing to do make
sure we have hit all of the major code paths.
I was wondering if anyone knows if a PCLint like product will detect this
issue we could use on our code base?
Thanks,
Dave
"WXS" wrote:
> The code below used to work fine with stlport and VC++ 6.0. I migrated the
> project to VS2003 C++ and now I get an exception within _vsnprintf when it
> tries to get the tstring variable test from the variable arguments list
> within the output function in the CRT internals it instead gets the value
> 0xcdcdcdcd instead of the pointer to the string.
>
> Anyone know why?
>
>
> //
> // typedef a TCHAR string as a tstring for future internationalization
> //
> typedef basic_string<TCHAR, char_traits<TCHAR>, allocator<TCHAR> > tstring;
>
>
> int _tmain(int argc, _TCHAR* argv[])
> {
>
>
> tstring test="MyTest";
> enum {MyItem1,MyItem2};
>
> CString info2="MyTest";
> TRACE2("%s(%d)", info2, MyItem1); //Works
> TRACE2("%s(%d)", test, MyItem1); //Causes exception
> return 0;
> }
.
- Follow-Ups:
- Re: basic_string causes crash in _vsnprintf???
- From: Hendrik Schober
- Re: basic_string causes crash in _vsnprintf???
- References:
- Prev by Date: Re: basic_string causes crash in _vsnprintf???
- Next by Date: Re: basic_string causes crash in _vsnprintf???
- Previous by thread: Re: basic_string causes crash in _vsnprintf???
- Next by thread: Re: basic_string causes crash in _vsnprintf???
- Index(es):
Relevant Pages
|