Click here to Skip to main content
15,916,456 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Convert from VS 6.0 project to VS .NET project Pin
Anthony_Yio23-Jun-04 0:36
Anthony_Yio23-Jun-04 0:36 
GeneralRe: Convert from VS 6.0 project to VS .NET project Pin
anderslundsgard23-Jun-04 1:23
anderslundsgard23-Jun-04 1:23 
GeneralRe: Convert from VS 6.0 project to VS .NET project Pin
Anthony_Yio23-Jun-04 16:09
Anthony_Yio23-Jun-04 16:09 
GeneralRe: Convert from VS 6.0 project to VS .NET project Pin
anderslundsgard29-Jun-04 23:50
anderslundsgard29-Jun-04 23:50 
GeneralODBC and C++ Pin
SuzannaS23-Jun-04 0:09
SuzannaS23-Jun-04 0:09 
GeneralRe: ODBC and C++ Pin
Sumit Kapoor23-Jun-04 1:50
Sumit Kapoor23-Jun-04 1:50 
GeneralRe: ODBC and C++ Pin
basementman23-Jun-04 5:34
basementman23-Jun-04 5:34 
GeneralStrange problem with CString Pin
rrrado22-Jun-04 23:43
rrrado22-Jun-04 23:43 
Hello,

I have class defined somethig like this :
class CAaa
{
 ...
  CString m_str;
 void Set();
}
CAaa::Set()
{
  CString tmp;
  // some processing with tmp
  m_str = tmp;
}

It's more complicated class, but this is the most important part.
Destructor of CAaa will crash the application in CString destructer,
which shows ASSERT in debug mode that it can't free the memory, because it's not valid memory block.
I found out that this won't happend when i use
m_str = (LPCSTR)tmp;
insead of
m_str = tmp;

Why the second thing is not working ? I know that there's only reference increment in second case, and copying of all data in first case,
but why doesn't the reference counting work correctly ?
Is this bad practice to assign member CString value of local CString in function ?
Thanks






rrrado
GeneralRe: Strange problem with CString Pin
David Crow23-Jun-04 4:07
David Crow23-Jun-04 4:07 
GeneralRe: Strange problem with CString Pin
rrrado23-Jun-04 4:31
rrrado23-Jun-04 4:31 
GeneralRe: Strange problem with CString Pin
rrrado23-Jun-04 4:49
rrrado23-Jun-04 4:49 
GeneralRe: Strange problem with CString Pin
David Crow23-Jun-04 4:59
David Crow23-Jun-04 4:59 
GeneralRe: Strange problem with CString Pin
rrrado23-Jun-04 5:33
rrrado23-Jun-04 5:33 
GeneralRe: Strange problem with CString Pin
rrrado23-Jun-04 5:57
rrrado23-Jun-04 5:57 
GeneralRe: Strange problem with CString Pin
jmkhael23-Jun-04 6:58
jmkhael23-Jun-04 6:58 
GeneralRe: Strange problem with CString Pin
Ravi Bhavnani23-Jun-04 7:06
professionalRavi Bhavnani23-Jun-04 7:06 
GeneralRe: Strange problem with CString Pin
jmkhael23-Jun-04 7:08
jmkhael23-Jun-04 7:08 
GeneralRe: Strange problem with CString Pin
David Crow23-Jun-04 7:11
David Crow23-Jun-04 7:11 
GeneralRe: Strange problem with CString Pin
jmkhael23-Jun-04 7:13
jmkhael23-Jun-04 7:13 
GeneralRe: Strange problem with CString Pin
David Crow23-Jun-04 7:07
David Crow23-Jun-04 7:07 
GeneralRe: Strange problem with CString Pin
rrrado23-Jun-04 20:57
rrrado23-Jun-04 20:57 
GeneralC++ STL help... using pointer in STL map Pin
Indrawati22-Jun-04 23:36
Indrawati22-Jun-04 23:36 
GeneralRe: C++ STL help... using pointer in STL map Pin
Johnny ²23-Jun-04 3:09
Johnny ²23-Jun-04 3:09 
GeneralRe: C++ STL help... using pointer in STL map Pin
Anonymous23-Jun-04 14:20
Anonymous23-Jun-04 14:20 
QuestionHow to Enable/Disable the hibernation support in VC++ Pin
ErisonWu22-Jun-04 21:57
ErisonWu22-Jun-04 21:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.