<?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>topic Re: //ACHAR(0) vs //''C in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883951#M76200</link>
    <description>&lt;PRE&gt;Your code does not protect against the possibility of no ''&lt;/PRE&gt;&lt;PRE&gt;! remove 'prog.exe' from gszDirBuffer&lt;BR /&gt;iPos = INDEX(gszDirBuffer, '', BACK = .TRUE.) &lt;BR /&gt;if(iPos .gt. 0) then&lt;BR /&gt;gszDirBuffer(iPos:size(gszDirBuffer)) = ' '&lt;BR /&gt;    gszDirBuffer(iPos:iPos) = ACHAR(0)&lt;BR /&gt;else&lt;BR /&gt;continue! put break point here&lt;BR /&gt;&lt;BR /&gt;endif&lt;/PRE&gt;&lt;PRE&gt;Jim Dempsey&lt;/PRE&gt;</description>
    <pubDate>Fri, 23 May 2008 20:39:48 GMT</pubDate>
    <dc:creator>jimdempseyatthecove</dc:creator>
    <dc:date>2008-05-23T20:39:48Z</dc:date>
    <item>
      <title>//ACHAR(0) vs //''C</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883947#M76196</link>
      <description>&lt;P&gt;Using IVF 9.1 on XP machine.&lt;/P&gt;
&lt;P&gt;GetModuleFileName() below returns the nul terminated str:&lt;BR /&gt;gszDirBuffer = 'C:DataIVF ModelProg.exe'&lt;/P&gt;
&lt;P&gt;An exception occurs in later code if gszDirBuffer is&lt;BR /&gt;terminated with ACHAR(0), as shown below, but NO&lt;BR /&gt;exception occurs if terminated with ''C. &lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;INTEGER(4) iPos&lt;BR /&gt; &lt;BR /&gt;CHARACTER(Max_Path+1) gszDirBuffer&lt;/P&gt;
&lt;P&gt;iret = GetModuleFileName(NULL, gszDirBuffer, (MAX_PATH+1))&lt;BR /&gt; &lt;BR /&gt;! remove 'prog.exe' from gszDirBuffer&lt;BR /&gt;iPos = INDEX(gszDirBuffer, '', BACK = .TRUE.) &lt;BR /&gt;&lt;BR /&gt;! ACHAR(0) here causes exception&lt;BR /&gt;gszDirBuffer = gszDirBuffer(1:iPos-1)//ACHAR(0)&lt;BR /&gt; &lt;BR /&gt;! ''C here does not cause exception&lt;BR /&gt;gszDirBuffer = gszDirBuffer(1:iPos-1)//''C&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;If I search for the nul char in both strings above using &lt;BR /&gt;iPos = INDEX(gszDirBuffer, ACHAR(0)), iPos is the &lt;BR /&gt;same for both lines of code.&lt;/P&gt;
&lt;P&gt;This is a Win32 program, and ACHAR(0) terminated str&lt;BR /&gt;appears to work as intended. The exception occurs in&lt;BR /&gt;code that does not appear related to any calcs that&lt;BR /&gt;use the ACHAR(0) terminated str.&lt;/P&gt;
&lt;P&gt;What is the difference between "//ACHAR(0)"&lt;BR /&gt;and "//''C" (no space between the appostrophes)?&lt;/P&gt;
&lt;P&gt;Thanks for any commentsinformation.&lt;/P&gt;</description>
      <pubDate>Thu, 22 May 2008 21:58:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883947#M76196</guid>
      <dc:creator>gelarimer</dc:creator>
      <dc:date>2008-05-22T21:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: //ACHAR(0) vs //''C</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883948#M76197</link>
      <description>There is no (supposed to be) any difference whatsoever. Personally, I prefer (A)CHAR(0) for portability, but that's just a style issue. &lt;BR /&gt;&lt;BR /&gt;I have a hunch that you have the real problem (silent out-of-bounds write? stack corruption? ) somewhere else, and that slight difference in code reveals it on an unrelated location (remember those pesky old-day run-time errors which suddenly disappear if you (re)move a WRITE statement). Or, please, show us the complete code which exhibits the problem.&lt;BR /&gt;&lt;BR /&gt;(Your code built with IVF 9.1.037 works as expected on my XP machine)&lt;BR /&gt;</description>
      <pubDate>Fri, 23 May 2008 07:13:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883948#M76197</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2008-05-23T07:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: //ACHAR(0) vs //''C</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883949#M76198</link>
      <description>Thanks for the reply. I think that "silent out-of-bounds write? stack corruption?" is probably correct, since the exception occurs just after a RETURN is encountered in an f90function. Proplem only occurs when the Release vs of the program is running, but will not occur when the Debug vs. is running.Code is extensive, involving calls to many routines before error occurs, so I will justsort through ituntil the problem is found.</description>
      <pubDate>Fri, 23 May 2008 12:42:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883949#M76198</guid>
      <dc:creator>gelarimer</dc:creator>
      <dc:date>2008-05-23T12:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: //ACHAR(0) vs //''C</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883950#M76199</link>
      <description>Sounds like an awkward bug to catch. Good luck finding it (fixing tends to be far easier). &lt;BR /&gt;&lt;BR /&gt;An idea just struck my mind: if you change all assumed-size (*) array arguments to assumed-shape (:) and then build with /gen-interfaces /warn:interfaces, you will get array bounds passed all round (unless there were type cheatings, in which case you won't be able to build the code). I'm not sure whether it will work, but could be worth a shot.&lt;BR /&gt;</description>
      <pubDate>Fri, 23 May 2008 13:21:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883950#M76199</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2008-05-23T13:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: //ACHAR(0) vs //''C</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883951#M76200</link>
      <description>&lt;PRE&gt;Your code does not protect against the possibility of no ''&lt;/PRE&gt;&lt;PRE&gt;! remove 'prog.exe' from gszDirBuffer&lt;BR /&gt;iPos = INDEX(gszDirBuffer, '', BACK = .TRUE.) &lt;BR /&gt;if(iPos .gt. 0) then&lt;BR /&gt;gszDirBuffer(iPos:size(gszDirBuffer)) = ' '&lt;BR /&gt;    gszDirBuffer(iPos:iPos) = ACHAR(0)&lt;BR /&gt;else&lt;BR /&gt;continue! put break point here&lt;BR /&gt;&lt;BR /&gt;endif&lt;/PRE&gt;&lt;PRE&gt;Jim Dempsey&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 May 2008 20:39:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883951#M76200</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2008-05-23T20:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: //ACHAR(0) vs //''C</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883952#M76201</link>
      <description>&lt;P&gt;Also,&lt;/P&gt;
&lt;P&gt;You could potentially have 'C:foo' or 'LPTxyz' as well as 'FOO.EXE'&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 May 2008 20:42:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883952#M76201</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2008-05-23T20:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: //ACHAR(0) vs //''C</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883953#M76202</link>
      <description>&lt;P&gt;Thanks for the replies Jim. &lt;/P&gt;
&lt;P&gt;GetModuleFileName(NULL, gszDirBuffer, (MAX_PATH+1)) should always return the path of the current process when the hModule = NULL.Since thecurrent process will always be My.exe, then the Fully Qualified Path (gszDirBuffer)should always be in the form "DriveLetter:~My.exe". Or, am I missing something? &lt;/P&gt;</description>
      <pubDate>Mon, 26 May 2008 13:43:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883953#M76202</guid>
      <dc:creator>gelarimer</dc:creator>
      <dc:date>2008-05-26T13:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: //ACHAR(0) vs //''C</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883954#M76203</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt;should always be in the form "DriveLetter:~My.exe".&lt;/P&gt;
&lt;P&gt;Or&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;"ServerShare~My.exe"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;And on NT (XP, Vista) there are some other special names that can appear in place of drive letter or server. As for your case I believe your code is correct in assuming &lt;/P&gt;
&lt;P&gt;"(unknown)My.exe".&lt;/P&gt;
&lt;P&gt;But you should also provide for&lt;/P&gt;
&lt;P&gt;"(unknown)/My.exe"&lt;/P&gt;
&lt;P&gt;This is to say test for either "" or "/". &lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 May 2008 15:24:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883954#M76203</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2008-05-26T15:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: //ACHAR(0) vs //''C</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883955#M76204</link>
      <description>&lt;P&gt;&lt;FONT&gt;Thanks Jim.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 May 2008 17:31:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ACHAR-0-vs-C/m-p/883955#M76204</guid>
      <dc:creator>gelarimer</dc:creator>
      <dc:date>2008-05-26T17:31:40Z</dc:date>
    </item>
  </channel>
</rss>

