Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9013855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:22:19+00:00 2026-06-16T03:22:19+00:00

Unfortunately the documentation I have is either (a) original product documentation without any errrata

  • 0

Unfortunately the documentation I have is either (a) original product documentation without any errrata (MS VC++ 6.0 help files) or (b) later MSDN help that applies to later MFC versions.

In particular:

[Q1] Is the operator += known to be buggy in VC++6 MFC CString? This code from VC++6 had to be fixed before it would even compile in a modern MFC app:

    CString szTemp;
    unsigned char m_chReceive[MY_BUF_SIZE];

    // compiles and seems to run but may be buggy in VC++6, won't compile in modern MFC
szTemp += m_chReceive; 
    // the above won't compile in modern MFC versions, but this "&+cast" does:
szTemp.Append( (const char *)&m_chReceive[0]); 

[Q2] Is it safe and robust to return a CString as the result of a function, in this manner, or does this cause memory corruption?

 CString MyClass:MyMethod(void)
 {   CString Stuff;
     // set a value to Stuff here.
     return Stuff; // return a stack-allocated-CString 
 }

I have code that uses the above two things all over the place and which also seems to exhibit random runtime memory corruption. Those two things are red flags to me, am I right in suspecting that CString was intended by the authors of MFC in Visual C++ 6.0 to be nice simple thing that you could use like it was an int or a char type, and return it from a function and somehow copy constructors and memory management all just worked?

Obvious stuff: Yes of course I will get all my code off VC++ 6.0 when I can, but I first need to patch a production system which is crashing, and then I can begin the huge task of moving this legacy codebase forward.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:22:20+00:00Added an answer on June 16, 2026 at 3:22 am

    According to Documentation for VC6.0

    CString objects can grow as a result of concatenation operations.
    CString objects follow “value semantics.”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Unfortunately I've a problem with IE =( I have a service on IIS that
I know it's possible to install a gem without the documentation, but unfortunately, I
Unfortunately, many Template Haskell functions have absolutely no documentation at all. One such function
I'm trying to find the specification that Vim uses for the documentation files (which
The socket.io documentation mentions that heartbeats can be disabled like so: io.disable('heartbeats'); Unfortunately, while
Unfortunately, I have to deal with J2ME (which I consider ancient technology these days)
Unfortunately, I have to use a C library with internal state in my Android
Unfortunately I have a pretty bad understanding of how to properly set up threading.
Unfortunately, I have plaintext passwords in a database. I want to pass these plaintext
I have a function, singleFrameEventHandler, that I wish to be called when a certain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.