std::string caveat

Never access an std::string‘s buffer with an intent to increase/decrease it’s length nor pass such a buffer to functions which takes a char*. I did this mistake sometime back and got trapped in a strange bug with operator +=. This is how my code looked. [sourcecode language=”cpp”]std::string str( ‘ ‘, MAX_PATH ); GetFolderName( pFullPath, &str[0] […]
Continue reading…

 

Project Conversion Bug in VS2008

Are you having trouble with VS2008 after conversion from VS2005 to VS2008? Most common complaints are that the executable is way to slow when compared to it’s counterpart generated with VS2005. The reason for this is given in this MSDN forum thread have a look… http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/fb32033b-7bad-439b-a94c-943a17f0cbb2 The essence of this thread is given below (quote […]
Continue reading…

 

Script error in VC++ wizards after installing IE8

You might have script errors in VC++ wizards after installing IE8, for e.g. when you double click inside a dialog normally we should taken to corresponding file but instead we get a script error… Pretty strange isn’t it. Well as per VC++ team blogs this bug due to IE8 installation. Reason for this behavior is […]
Continue reading…

 

Choosing between a function and a macro definition

This is a common and a funny problem. So what is this all about? Let me put it like this… We have a standard “c” function called _toupper and an equivalent macro is also available called _toupper. So my question is how to call function version of _toupper explicitly, if we write _toupper, macro version  […]
Continue reading…

 

Variable value is always’s zero, no matter what you do!

Recently a friend of mine (sitting just behind me) had a strange problem. I wrote an inline function which was like… void SetBlah( const bool IsBlah ) { m_IsBlah = IsBlah; } Now he was using this function since we work for the same project! So he had a value 1 for IsBlah when calling […]
Continue reading…