<?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: Compiler warning with character*(*) function in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855179#M67223</link>
    <description>Tim has it mostly right. CHARACTER(*) is fine in current Fortran for dummy arguments, but is deprecated for function declarations and it's not supported for use in interface blocks. Because new projects default to /gen-interface, the compiler wants to generate an interface for this function but can't, hence the warning.&lt;BR /&gt;&lt;BR /&gt;Tim also has the right approach for a modern replacement, but using this requires an explicit interface to be visible to the caller (and a generated interface won't do.)&lt;BR /&gt;&lt;BR /&gt;You could ignore the warning, or even turn off generated interface creation and checking if this is a concern to you.&lt;BR /&gt;</description>
    <pubDate>Thu, 17 Jul 2008 13:46:43 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2008-07-17T13:46:43Z</dc:date>
    <item>
      <title>Compiler warning with character*(*) function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855176#M67220</link>
      <description>&lt;P&gt;The following works OK ...&lt;/P&gt;
&lt;BLOCKQUOTE dir="ltr"&gt;
&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;character*(*) function upper(string)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color="#008000"&gt;!Returns the upper case version of the input STRING.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;implicit none&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;character*(*) string&lt;BR /&gt;character*1024 temp&lt;BR /&gt;integer*4 i,l&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;l = len(string)&lt;BR /&gt;temp = string&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;do i = 1,l&lt;BR /&gt; if(temp(i:i).ge.'a'.and.temp(i:i).le.'z')then&lt;BR /&gt; temp(i:i) = char(ichar(temp(i:i))-32)&lt;BR /&gt; end if&lt;BR /&gt;end do&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;upper = temp(1:l)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;return&lt;BR /&gt;end&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir="ltr"&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;&lt;FONT face="Times New Roman" color="#000000"&gt;But the compiler warns me :&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face="Courier New" color="#0000ff"&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Warning: A CHARACTER function name must not be declared with an asterisk type-param-value (i.e., (LEN=*)) if the function is part of an interface-body. No interface block will be generated. [UPPER]&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Times New Roman" color="#000000" size="2"&gt;Can I just ignore this or is there a better way to write the function?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Times New Roman" color="#000000" size="2"&gt;With many thanks&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Times New Roman" color="#000000" size="2"&gt;Mike&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;</description>
      <pubDate>Thu, 17 Jul 2008 01:52:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855176#M67220</guid>
      <dc:creator>michael_green</dc:creator>
      <dc:date>2008-07-17T01:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler warning with character*(*) function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855177#M67221</link>
      <description>Strange, I just copy-pasted your function as it is and compiled it and it gave me no warning, i even used it on a test case successfully.&lt;BR /&gt;&lt;BR /&gt;Can you please post your calling program here ?&lt;BR /&gt;&lt;BR /&gt;Thanks..&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Jul 2008 02:18:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855177#M67221</guid>
      <dc:creator>TinTin_9</dc:creator>
      <dc:date>2008-07-17T02:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler warning with character*(*) function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855178#M67222</link>
      <description>I take it that /gen-interfaces was set. character *(*) is one of the few things which was new in f77 which I believe is disrecommended since f90. In the present context, I believe it was not strictly legal in f77, which would take away f77 compatibility as an argument for using this syntax.&lt;BR /&gt;character(len=len(string)) function(string)&lt;BR /&gt;appears to be a legitimate equivalent (in f90), by my reading of MR&amp;amp;C. If this doesn't work, with or without /gen-interfaces, I think it would be worth a submission on premier.intel.com for further study.&lt;BR /&gt;Of course, if you're trying to find something which doesn't involve abuse of Fortran syntax, you'll also fix integer*4.&lt;BR /&gt;Something like&lt;BR /&gt;character(len=len(string)) temp&lt;BR /&gt;might be better, given that you are using an f90 compiler, unless you can guarantee that len=1024 will not be exceeded, and that 1024 is not an excessive extension of the string length.&lt;BR /&gt;This code appears to be trying to fit within f77, "except for a few exceptions," to its detriment.&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Jul 2008 05:33:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855178#M67222</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2008-07-17T05:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler warning with character*(*) function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855179#M67223</link>
      <description>Tim has it mostly right. CHARACTER(*) is fine in current Fortran for dummy arguments, but is deprecated for function declarations and it's not supported for use in interface blocks. Because new projects default to /gen-interface, the compiler wants to generate an interface for this function but can't, hence the warning.&lt;BR /&gt;&lt;BR /&gt;Tim also has the right approach for a modern replacement, but using this requires an explicit interface to be visible to the caller (and a generated interface won't do.)&lt;BR /&gt;&lt;BR /&gt;You could ignore the warning, or even turn off generated interface creation and checking if this is a concern to you.&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Jul 2008 13:46:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855179#M67223</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2008-07-17T13:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler warning with character*(*) function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855180#M67224</link>
      <description>&lt;P&gt;/gen-interface was not set, but it made no difference either way anyway.&lt;/P&gt;
&lt;P&gt;The following:&lt;/P&gt;
&lt;P&gt;character(len=len(string)) function upper(string)&lt;/P&gt;
&lt;P&gt;does not compile. I get "The data types of the argument(s) are invalid. (LEN)"&lt;/P&gt;
&lt;P&gt;Maybe I'll just take Steve's advice and ignore the warnings.&lt;/P&gt;
&lt;P&gt;Many thanks&lt;/P&gt;
&lt;P&gt;Mike&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2008 01:21:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855180#M67224</guid>
      <dc:creator>michael_green</dc:creator>
      <dc:date>2008-07-18T01:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler warning with character*(*) function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855181#M67225</link>
      <description>Generated interfaces had to be enabled or otherwise you would not have received that initial message. It is on by default in a newly created project. Look under Project &amp;gt; Properties &amp;gt; Fortran &amp;gt; Diagnostics&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Jul 2008 11:49:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855181#M67225</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2008-07-18T11:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler warning with character*(*) function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855182#M67226</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;IMG src="https://community.intel.com/file/6745" /&gt; &lt;STRONG&gt;michaelgreen:&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;
&lt;P&gt;The following:&lt;/P&gt;
&lt;P&gt;character(len=len(string)) function upper(string)&lt;/P&gt;
&lt;P&gt;does not compile. I get "The data types of the argument(s) are invalid. (LEN)"&lt;/P&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;Didn't test myself, but most likely it's just an issue of declaration order. The following certainly works:&lt;BR /&gt;&lt;PRE&gt;function upper(string)&lt;BR /&gt;   character(*), intent(in):: string&lt;BR /&gt; character(len=len(string)):: upper&lt;BR /&gt;&lt;/PRE&gt;
&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Jul 2008 14:04:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855182#M67226</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2008-07-18T14:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler warning with character*(*) function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855183#M67227</link>
      <description>&lt;P&gt;Thanks, Jugoslav,&lt;/P&gt;
&lt;P&gt;That certainly compiles and nearly gives the right answer, but there is a small problem that I am unable to solve. If I have:&lt;/P&gt;
&lt;BLOCKQUOTE dir="ltr"&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;character*20username,upper&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;character*128line&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;username = 'MichaelG'&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;line = 'michaelg,manager,casual,user'&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;i = index(line,',')&lt;/FONT&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;&lt;B&gt;if&lt;/B&gt;(upper(line(1:i-1))==upper(username))found = .true.&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir="ltr"&gt;&lt;FONT color="#000000"&gt;found remains false because upper(username) = 'MICHAELG' but upper(line(1:i-1)) = 'MICHAELG#%&amp;amp;!!'Actually, I get Chinese characters after my name, but the point is the same. Sorry to be a pain.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir="ltr"&gt;Thanks for your help,&lt;/P&gt;
&lt;P dir="ltr"&gt;Mike&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2008 01:39:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855183#M67227</guid>
      <dc:creator>michael_green</dc:creator>
      <dc:date>2008-07-22T01:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler warning with character*(*) function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855184#M67228</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;IMG src="https://community.intel.com/file/6745" /&gt; &lt;STRONG&gt;michaelgreen:&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;BLOCKQUOTE dir="ltr"&gt;
&lt;P&gt;&lt;FONT color="#0000ff"&gt;character*20 upper&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P dir="ltr"&gt;&lt;FONT color="#000000"&gt;upper(line(1:i-1)) = 'MICHAELG#%&amp;amp;!!'Actually, I get Chinese characters after my name, but the point is the same. &lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;Exactly: you get "MICHAELG" plus some random garbage off the stack, to make the 20 characters -- because you've just falsely declared upper to return a 20-character string. You have to have an explicit interface (best, function Upper in a MODULE) to have it work as desired.&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Jul 2008 07:47:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855184#M67228</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2008-07-22T07:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Compiler warning with character*(*) function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855185#M67229</link>
      <description>&lt;P&gt;I have never had any problems with the following conversion routine which seems to avoid some of the problems above.&lt;/P&gt;
&lt;P&gt;function Upc(String)&lt;BR /&gt;! Returns String in upper case. String itself is not converted.&lt;BR /&gt;use user32, only : CharUpper&lt;BR /&gt;implicit none&lt;BR /&gt;character*(*), intent(in) :: String ! Input string.&lt;BR /&gt;character(len(String)) :: Upc ! Function type.&lt;BR /&gt;integer*4 :: i ! Working variable.&lt;BR /&gt;Upc = String  ! Set Upc to preserve String.&lt;BR /&gt;i = CharUpper(Upc) ! Convert String using WinAPI function.&lt;BR /&gt;return&lt;BR /&gt;end function Upc&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;Bear of Little Brain&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2008 21:03:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-warning-with-character-function/m-p/855185#M67229</guid>
      <dc:creator>llynisa</dc:creator>
      <dc:date>2008-07-22T21:03:50Z</dc:date>
    </item>
  </channel>
</rss>

