<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — Small problem debugging character variables]]></title>
	<link rel="self" href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=431&amp;type=atom" />
	<updated>2015-01-31T21:04:53Z</updated>
	<generator>PunBB</generator>
	<id>https://forums.approximatrix.com/viewtopic.php?id=431</id>
		<entry>
			<title type="html"><![CDATA[Re: Small problem debugging character variables]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=1866#p1866" />
			<content type="html"><![CDATA[<p>Thanks Jeff.</p><p>In order to pass character variables, a hidden argument containing the length is also passed. This has the same name as the variable prefixed with _. </p><p>However, users are not allowed to declare variables prefixed with _ so one option open to you would be to suppress such variables from the list.</p><p>So this is just a suggestion and not a bug at all. <img src="https://forums.approximatrix.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[davidb]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3463</uri>
			</author>
			<updated>2015-01-31T21:04:53Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=1866#p1866</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Small problem debugging character variables]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=1862#p1862" />
			<content type="html"><![CDATA[<p>David,</p><p>The presence of <em>_name</em> is somewhat of a legacy of Fortran compilers.&nbsp; Unlike your local character variable, the <em>name</em> variable was an argument.&nbsp; Historically, and GNU Fortran might do this for compatibility reasons, the length of a character of assumed length always followed the character itself.&nbsp; I don&#039;t believe GNU&#039;s old g77 compiler would do this same procedure with arrays, though, which is why you wouldn&#039;t see something similar.</p><p>Clearly your <em>nice</em> local variable also has a length stored somehow and somewhere, but if you were to pass it to another subroutine as an argument, there would be a corresponding <em>_nice</em> since it would be necessary for compatibility.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2015-01-29T23:33:33Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=1862#p1862</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Small problem debugging character variables]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=1861#p1861" />
			<content type="html"><![CDATA[<p>This is not a big problem. I can see that <em>_name</em> is the length of the variable. However, this is not consistent with the way other variables are listed. It seems to happen only with character dummy arguments. If I add a new local character(len=10) variable to the example it is listed without an additional &quot;length&quot; variable:</p><div class="codebox"><pre><code>subroutine greet(name)
   character(len=*) :: name
   character(len=10) :: nice
   nice = &#039;, good day&#039;
   print *,&#039;Hello &#039;,trim(name), nice
end subroutine greet

program main
   character(len=10) :: name
   name = &#039;Michael&#039;
   call greet(name)
end program main</code></pre></div>]]></content>
			<author>
				<name><![CDATA[davidb]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3463</uri>
			</author>
			<updated>2015-01-29T21:56:27Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=1861#p1861</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Small problem debugging character variables]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=1857#p1857" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>davidb wrote:</cite><blockquote><p>The debugger doesn&#039;t properly list the local variables in subroutine greet in the following example.</p></blockquote></div><p>David,</p><p>I&#039;m not sure what you&#039;re seeing that you&#039;d classify as incorrect.&nbsp; When I debug, I enter the <em>greet</em>&nbsp; subroutine, and I see two local variables, <em>_name</em> and <em>name</em>.&nbsp; The former is an artifact of using assumed-length character strings, and it shows a correct value of 10.&nbsp; The latter is the character string&nbsp; itself, and it appears to be correct as well.&nbsp; What seemed to be the issue in your case?</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2015-01-29T12:38:38Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=1857#p1857</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Small problem debugging character variables]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=1854#p1854" />
			<content type="html"><![CDATA[<p>The debugger doesn&#039;t properly list the local variables in subroutine greet in the following example.</p><div class="codebox"><pre><code>subroutine greet(name)
   character(len=*) :: name
   print *,&#039;Hello &#039;,trim(name)
end subroutine greet

program main
   character(len=10) :: name
   name = &#039;Michael&#039;
   call greet(name)
end program main</code></pre></div>]]></content>
			<author>
				<name><![CDATA[davidb]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3463</uri>
			</author>
			<updated>2015-01-28T18:50:02Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=1854#p1854</id>
		</entry>
</feed>
