<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Intel® Fortran Compiler中的主题 String question</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/String-question/m-p/767216#M20719</link>
    <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;P&gt;Bothuses of the string szFileName(iPos1+1:iPos2-1)//' - Graph'C below compile OK, but not sure if the first construct is really legal. I believe that &lt;BR /&gt;loc(szFileName(iPos1+1:iPos2-1) is OK, but not sure aboutconcatenating the ' - Graph'C as part of the arg for loc(). If the first construct is legal,how does IVF handle the memory for the contatenated string? Is a new memory location created? Thanks for comments.&lt;/P&gt;
&lt;P&gt;di%lpszDocName = &lt;FONT color="#0000ff"&gt;loc&lt;/FONT&gt;(szFileName(iPos1+1:iPos2-1)//' - Graph'C)&lt;/P&gt;
&lt;P&gt;or,&lt;/P&gt;
&lt;P&gt;character(Max_Path) szName&lt;BR /&gt;szName = szFileName(iPos1+1:iPos2-1)//' - Graph'C)&lt;BR /&gt;di%lpszDocName = &lt;FONT color="#0000ff"&gt;loc&lt;/FONT&gt;(szName)&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Message Edited by halcyong@fcc.net on &lt;SPAN class="date_text"&gt;02-28-2006&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;04:47 AM&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Feb 2006 20:45:18 GMT</pubDate>
    <dc:creator>ahasan</dc:creator>
    <dc:date>2006-02-28T20:45:18Z</dc:date>
    <item>
      <title>String question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/String-question/m-p/767216#M20719</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;P&gt;Bothuses of the string szFileName(iPos1+1:iPos2-1)//' - Graph'C below compile OK, but not sure if the first construct is really legal. I believe that &lt;BR /&gt;loc(szFileName(iPos1+1:iPos2-1) is OK, but not sure aboutconcatenating the ' - Graph'C as part of the arg for loc(). If the first construct is legal,how does IVF handle the memory for the contatenated string? Is a new memory location created? Thanks for comments.&lt;/P&gt;
&lt;P&gt;di%lpszDocName = &lt;FONT color="#0000ff"&gt;loc&lt;/FONT&gt;(szFileName(iPos1+1:iPos2-1)//' - Graph'C)&lt;/P&gt;
&lt;P&gt;or,&lt;/P&gt;
&lt;P&gt;character(Max_Path) szName&lt;BR /&gt;szName = szFileName(iPos1+1:iPos2-1)//' - Graph'C)&lt;BR /&gt;di%lpszDocName = &lt;FONT color="#0000ff"&gt;loc&lt;/FONT&gt;(szName)&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Message Edited by halcyong@fcc.net on &lt;SPAN class="date_text"&gt;02-28-2006&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;04:47 AM&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2006 20:45:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/String-question/m-p/767216#M20719</guid>
      <dc:creator>ahasan</dc:creator>
      <dc:date>2006-02-28T20:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: String question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/String-question/m-p/767217#M20720</link>
      <description>Yes, the argument to LOC() can be pretty much anything. If it's an expression, the compiler will appoint a location on the stack for the result and LOC() will return that address.&lt;BR /&gt;&lt;BR /&gt;However, the documentation does not discuss the lifetime of such stack variable (i.e. when the stack is erased). It's almost certainly OK to supply it as an argument to a function:&lt;BR /&gt;&lt;PRE&gt;call SomeAPI(LOC(string1//string2))&lt;/PRE&gt;&lt;BR /&gt;I'm not so sure about the "intermediate" approach as you described it (assign it to a variable and pass it to an API shortly afterwards). Steve should be able to tell you better  the important issue is whether the stack is cleaned up on the next line or when the containing routine ends  my guess is the latter (in which case it's OK to reuse the returned address subsequently in the same routine), but it's better to be on the safe side in the meanwhile.</description>
      <pubDate>Tue, 28 Feb 2006 21:33:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/String-question/m-p/767217#M20720</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2006-02-28T21:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: String question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/String-question/m-p/767218#M20721</link>
      <description>Jugoslav's suspicions are correct - loc(expression) is valid only until the end of the statement.  After that, the contents of the expression are undefined, so it is incorrect to save the address of an expression across statements.</description>
      <pubDate>Tue, 28 Feb 2006 22:02:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/String-question/m-p/767218#M20721</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2006-02-28T22:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: String question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/String-question/m-p/767219#M20722</link>
      <description>&lt;P&gt;Just to make sure I understand correctly:&lt;/P&gt;
&lt;P&gt;di%lpszDocName = &lt;FONT color="#0000ff"&gt;loc&lt;/FONT&gt;(str1//str2) is OK,&lt;BR /&gt;&lt;BR /&gt;but incorrect to use di%lpszDocName in a subsequent statement because the addressmayhave been overwritten on the stack.&lt;/P&gt;
&lt;P&gt;Thanks for the replies.&lt;/P&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 01 Mar 2006 02:29:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/String-question/m-p/767219#M20722</guid>
      <dc:creator>ahasan</dc:creator>
      <dc:date>2006-03-01T02:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: String question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/String-question/m-p/767220#M20723</link>
      <description>Right.  The statement will compile and execute fine, but the value stored in the field won't necessarily point to anything useful in subsequent statements.</description>
      <pubDate>Wed, 01 Mar 2006 03:31:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/String-question/m-p/767220#M20723</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2006-03-01T03:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: String question</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/String-question/m-p/767221#M20724</link>
      <description>Thank you.
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 01 Mar 2006 04:32:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/String-question/m-p/767221#M20724</guid>
      <dc:creator>ahasan</dc:creator>
      <dc:date>2006-03-01T04:32:24Z</dc:date>
    </item>
  </channel>
</rss>

