<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : CString functi&#111;n parameter</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : CString functi&#111;n parameter]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Mon, 06 Apr 2026 17:26:29 +0000</pubDate>
  <lastBuildDate>Sun, 12 Feb 2006 16:37:50 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=3548</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[CString functi&#111;n parameter : Are you under the impression that...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3548&amp;PID=10937&amp;title=cstring-function-parameter#10937</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1003">Warren</a><br /><strong>Subject:</strong> 3548<br /><strong>Posted:</strong> 12 February 2006 at 4:37pm<br /><br />Are you under the impression that CString allocates a new copy of thetext, and copies the text into the new buffer each time you return "CString" instead of "const CString&amp;"?Because that is <span style="font-weight: bold;">not</span> how it works.<br><br>AFAIK, CString has a COW (copy on write) implementation, so what are you really saving? It's basically:<br><br>return 1 pointer/reference<br>vs.<br>change reference count, return 1 pointer/reference<br><br>Either way, I wouldn't worry about it nowadays. With 2+ Ghz computers, 99% of optimization is algorithmic and not tweaking code.<br><br>That's just my 2 cents...<br>]]>
   </description>
   <pubDate>Sun, 12 Feb 2006 16:37:50 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3548&amp;PID=10937&amp;title=cstring-function-parameter#10937</guid>
  </item> 
  <item>
   <title><![CDATA[CString functi&#111;n parameter : Hi,  1) if i call a function...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3548&amp;PID=10934&amp;title=cstring-function-parameter#10934</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=233">jimmy</a><br /><strong>Subject:</strong> 3548<br /><strong>Posted:</strong> 12 February 2006 at 8:21am<br /><br />Hi,<br><br>1) if i call a function many time, i use <br><br>static CString s_strText(_T("My Text"));<br><br>Function( s_strText );<br>And void Function( const CString&amp; strText );<br><br>So it must alloc the text only one time.<br><br>In some function i use also (LPCTSTR lpText), but only if it call not often.<br><br>also use as return parameter<br>const CString&amp; GetName()<br>{ return m_stName; }<br><br>The most time if you call GetName (or other) is, to put the paramter to other function.<br><br>x.SetName( y.GetName() );<br><br>So this is much faster than always create a new CString.<br><br>If i look into our program code, 95 percent of function call put a CString as parameter.<br><br>&nbsp;&nbsp;&nbsp; Jimmy<br><br>]]>
   </description>
   <pubDate>Sun, 12 Feb 2006 08:21:48 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3548&amp;PID=10934&amp;title=cstring-function-parameter#10934</guid>
  </item> 
  <item>
   <title><![CDATA[CString functi&#111;n parameter : Jimmy,  You said &amp;#034;...LPCTSTR...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3548&amp;PID=10846&amp;title=cstring-function-parameter#10846</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1003">Warren</a><br /><strong>Subject:</strong> 3548<br /><strong>Posted:</strong> 07 February 2006 at 10:30am<br /><br /><P>Jimmy, </P><P>You said "...LPCTSTR is also not good..." but according to Microsoft: "...in most cases it is best to declare the string function parameter as <B>LPCTSTR..."</B></P><P><A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_Strings.3a_.CString_Argument_Passing.asp" target="_blank"> http://msdn.microsoft.com/library/default.asp?url=/library/e n-us/vccore/html/_core_Strings.3a_.CString_Argument_Passing. asp</A></P>]]>
   </description>
   <pubDate>Tue, 07 Feb 2006 10:30:27 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3548&amp;PID=10846&amp;title=cstring-function-parameter#10846</guid>
  </item> 
  <item>
   <title><![CDATA[CString functi&#111;n parameter : lets see. if method declared...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3548&amp;PID=10679&amp;title=cstring-function-parameter#10679</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 3548<br /><strong>Posted:</strong> 25 January 2006 at 8:49am<br /><br /><P>lets see.</P><P>if method declared as SomeMethods(cont CString&amp; strItem)</P><P>and called as </P><P>SomeMethod(_T("SomParameter"));</P><P>anyway compiller first create CString variable and assign it with "SomParameter", and later destroy it.</P><P>&nbsp;</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Wed, 25 Jan 2006 08:49:48 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3548&amp;PID=10679&amp;title=cstring-function-parameter#10679</guid>
  </item> 
  <item>
   <title><![CDATA[CString functi&#111;n parameter : Hi oleg,LPCTSTR is also not good,...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3548&amp;PID=10672&amp;title=cstring-function-parameter#10672</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=233">jimmy</a><br /><strong>Subject:</strong> 3548<br /><strong>Posted:</strong> 25 January 2006 at 5:09am<br /><br />Hi oleg,<br><br>LPCTSTR is also not good, because<br>if you do m_strCaption = lpszParameter it always make<br>a strlen, alloc. <br>It's slow, and higher memory defragmentation.<br>For compatibility it's ok.<br>But for new, i think const CString&amp; is the best solution.<br><br>&nbsp;&nbsp;&nbsp; Jimmy<br><br><br>]]>
   </description>
   <pubDate>Wed, 25 Jan 2006 05:09:40 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3548&amp;PID=10672&amp;title=cstring-function-parameter#10672</guid>
  </item> 
  <item>
   <title><![CDATA[CString functi&#111;n parameter : Hi, 1. Agree :) Thank you 2....]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3548&amp;PID=10657&amp;title=cstring-function-parameter#10657</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 3548<br /><strong>Posted:</strong> 24 January 2006 at 1:56pm<br /><br /><P>Hi,</P><P>1. Agree :)&nbsp; Thank you</P><P>2. Actually in 9.81 we&nbsp;changed most of&nbsp;"CString strParameter" to "LPCTSTR lpszParameter" </P><P>some virtual methods we can't change to avoid your complains about compatibility ;)</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Tue, 24 Jan 2006 13:56:45 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3548&amp;PID=10657&amp;title=cstring-function-parameter#10657</guid>
  </item> 
  <item>
   <title><![CDATA[CString functi&#111;n parameter : Hello CodeJock Team,  1) the...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3548&amp;PID=10639&amp;title=cstring-function-parameter#10639</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=233">jimmy</a><br /><strong>Subject:</strong> 3548<br /><strong>Posted:</strong> 23 January 2006 at 4:30am<br /><br />Hello CodeJock Team,<br><br>1) the codejock software is great.<br><br>2) optimize point<br>&nbsp;&nbsp;&nbsp; a big part of the software have FunctionName(CString strParam)<br>but it is better use FunctionName(const CString&amp; strParam)<br>The software ist much faster, less memory defragmentation, smaller code size.<br>Please, change this for the next release.<br>also look for other function parameter, to add the parameter as<br>const referenz.<br><br>&nbsp;&nbsp;&nbsp; Jimmy<br><br>]]>
   </description>
   <pubDate>Mon, 23 Jan 2006 04:30:25 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3548&amp;PID=10639&amp;title=cstring-function-parameter#10639</guid>
  </item> 
 </channel>
</rss>