Re: basic_string causes crash in _vsnprintf???

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hendrik Schober wrote:
WXS <WXS@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

[...]
I was wondering if anyone knows if a PCLint like product will detect this
issue we could use on our code base?

I don't, but it seems that if you replace 'printf()' with some overloaded functions template and compile with that, you would be able to have compiler errors generated. Um, off the top of my head...

    // beware, uncimpiled code ahead
    int printf(const char*)


template< typename T1 > int printf(const char*, T1) { testForStr<T1>(); }
.... (snip)

I tried this line of thinking, but last time I tried,
I think problem was ambiguity, that "string" can be automatically casted
to be std::string...

Maybe it works, by defining
  testForStr<const char*>()
before
  testForStr<const std::string>()
Maybe time to try again...

Thanks


muchan .