-
February 14th, 2012, 06:54 AM
#1
Do I have to delete TEXT("...") strings?
Hi,
if I have the following:
Code:
LPCTSTR text = TEXT("This is my text");
do I have to
I guess no, because it crashes when I'm doing this ^^
but doesn't this memory have to be freed?
-
February 14th, 2012, 08:11 AM
#2
Re: Do I have to delete TEXT("...") strings?
You must not delete what you didn't new.
Originally Posted by chaos2oo2
but doesn't this memory have to be freed?
What memory do you mean?
Victor Nijegorodov
-
February 16th, 2012, 01:27 AM
#3
Re: Do I have to delete TEXT("...") strings?
TEXT("...") is a macro that expands to L"..." or "..." if UNICODE is or is not defined.
Both, L"..." and "..." are string literals.
A string literal has static storage duration, which means it exists for the all duration of the program.
You have not to allocate/free memory for string literals.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|