MSVS 2019 v16.9.2 Debug shows incorrect string value.

slipbits 16 Reputation points
2021-03-19T22:16:13.683+00:00

The string in question is:
string pattern = ".*" + fs + ')' + '"'; // fs = ':'
Debug shows pattern = " ENDFILE\n".

Same for string pattern(".*" + fs + ')' + '"');

Same for string& pattern = *(new string(".*" + fs + ')' + '"'));

ENDFILE is the name of a method in an included header file:

class Callback {
public:
   virtual void PROCESS() = 0;   //!< callback function called for each line
   virtual void BEGIN() = 0;       //!< callback function called before any processing
   virtual void END() = 0;         //!< callback function called when processing complete
   virtual void BEGINFILE() = 0; //!< callback function called before file processing
   virtual void ENDFILE() = 0;   //!< callback function called after file end
   virtual void NULLFUNC() = 0;  //!< callback function does nothing
}; // class Callback

This code is in a constructor. Anyone know how to fix it?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,527 questions
{count} votes