<?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 Yes, you should have added a in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933557#M88388</link>
    <description>Yes, you should have added a default initialization for pp to NULL() as was done for other pointer components. The DEALLOCATE will set it to null automatically.</description>
    <pubDate>Wed, 24 Oct 2012 17:30:46 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2012-10-24T17:30:46Z</dc:date>
    <item>
      <title>This binary operation is invalid for this data type, but why ?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933552#M88383</link>
      <description>&lt;P&gt;I have written a module ( a prt of it shown here) and subroutine inside it, as follows:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;module class_mg&lt;/LI&gt;
&lt;LI&gt;type ptr&lt;/LI&gt;
&lt;LI&gt;type(c), pointer :: pp&lt;/LI&gt;
&lt;LI&gt;end type ptr&lt;/LI&gt;
&lt;LI&gt;!............&lt;/LI&gt;
&lt;LI&gt;type c&lt;/LI&gt;
&lt;LI&gt;!............&lt;/LI&gt;
&lt;LI&gt;integer c_no&lt;/LI&gt;
&lt;LI&gt;type(c), pointer :: prnt=&amp;gt;NULL()&lt;/LI&gt;
&lt;LI&gt;type(ptr), pointer :: ng(:)=&amp;gt;NULL()&lt;/LI&gt;
&lt;LI&gt;type(ptr), pointer :: ch(:)=&amp;gt;NULL()&lt;/LI&gt;
&lt;LI&gt;integer compc&lt;/LI&gt;
&lt;LI&gt;!............&lt;/LI&gt;
&lt;LI&gt;end type c&lt;/LI&gt;
&lt;LI&gt;!............&lt;/LI&gt;
&lt;LI&gt;type(c), pointer :: root&lt;/LI&gt;
&lt;LI&gt;!............&lt;/LI&gt;
&lt;LI&gt;!............&lt;/LI&gt;
&lt;LI&gt;contains&lt;/LI&gt;
&lt;LI&gt;recursive subroutine set_ng(c_no, root)&lt;/LI&gt;
&lt;LI&gt;type(c), pointer :: root&lt;/LI&gt;
&lt;LI&gt;if(c_no==0) then&lt;/LI&gt;
&lt;LI&gt;!............&lt;/LI&gt;
&lt;LI&gt;root%ng(3)%pp=&amp;gt;root%prnt%ch(3)%pp&lt;/LI&gt;
&lt;LI&gt;root%ng(2)%pp=&amp;gt;root%prnt%ch(1)%pp&lt;/LI&gt;
&lt;LI&gt;if(root%prnt%ng(1)%pp /= 0 .and. root%prnt%ng(1)%pp%compc==0) then&lt;/LI&gt;
&lt;LI&gt;root%ng(1)%pp=&amp;gt;root%prnt%ng(1)%pp%ch(3)%pp&lt;/LI&gt;
&lt;LI&gt;root%prnt%ng(1)%pp%ch(3)%pp%ng(3)%pp=&amp;gt;root&lt;/LI&gt;
&lt;LI&gt;end if&lt;/LI&gt;
&lt;LI&gt;!............&lt;/LI&gt;
&lt;LI&gt;end if&lt;/LI&gt;
&lt;LI&gt;end subroutine set_ng&lt;/LI&gt;
&lt;LI&gt;end module class_mg&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;The code fails to compile, &amp;nbsp;returning the following error message in line 26:&amp;nbsp;error #6355: This binary operation is invalid for this data type. &amp;nbsp; [PP]&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Am I doing something wrong? Thanks&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Emre K.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2012 13:30:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933552#M88383</guid>
      <dc:creator>emreka82</dc:creator>
      <dc:date>2012-10-23T13:30:15Z</dc:date>
    </item>
    <item>
      <title>Use ASSOCIATED to ask if the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933553#M88384</link>
      <description>Use ASSOCIATED to ask if the pointer is associated (not null).</description>
      <pubDate>Tue, 23 Oct 2012 15:20:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933553#M88384</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2012-10-23T15:20:11Z</dc:date>
    </item>
    <item>
      <title>if(root%prnt%ng(1)%pp /= 0</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933554#M88385</link>
      <description>&lt;BLOCKQUOTE&gt;if(root%prnt%ng(1)%pp /= 0&lt;/BLOCKQUOTE&gt;

attempts to compare a value of type integer to a component of type pointer variable of type(c), and

&lt;BLOCKQUOTE&gt;root%prnt%ng(1)%pp%compc==0&lt;/BLOCKQUOTE&gt;

compares a component of type integer to an integer.

The former comparison is invalid; nor is it clear what the intended effect may be.</description>
      <pubDate>Tue, 23 Oct 2012 15:55:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933554#M88385</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2012-10-23T15:55:39Z</dc:date>
    </item>
    <item>
      <title>Quote:mecej4 wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933555#M88386</link>
      <description>&lt;BLOCKQUOTE&gt;mecej4 wrote:&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;if(root%prnt%ng(1)%pp /= 0&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;attempts to compare a value of type integer to a component of type pointer variable of type(c), and&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;P&gt;root%prnt%ng(1)%pp%compc==0&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;compares a component of type integer to an integer.&lt;/P&gt;
&lt;P&gt;The former comparison is invalid; nor is it clear what the intended effect may be.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;

Actually, I want to wrote:  if(root%prnt%ng(1) /= 0, but because of the array definition in a pointer does not work like this in Fortran, I have to show it with a ragged array and use pp... So I want to say that if the first holder of the array ng is not equal to zero then if condition can be used. Is it clear ?

When I do that thing with the C++ code (such as; root-&amp;gt;prnt-&amp;gt;ng[1] != 0 ) in a similar fashion, there is no error, which is also interesting for me...</description>
      <pubDate>Wed, 24 Oct 2012 17:19:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933555#M88386</guid>
      <dc:creator>emreka82</dc:creator>
      <dc:date>2012-10-24T17:19:33Z</dc:date>
    </item>
    <item>
      <title>Quote:Steve Lionel (Intel)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933556#M88387</link>
      <description>&lt;BLOCKQUOTE&gt;Steve Lionel (Intel) wrote:&lt;BR /&gt;&lt;P&gt;Use ASSOCIATED to ask if the pointer is associated (not null).&lt;/P&gt;&lt;/BLOCKQUOTE&gt;

Steve,
Shouldn't I have to nullify the pointer before allocate it, and also at the end of the use deallocate ? ASSOCIATED is the checking of it, right ?</description>
      <pubDate>Wed, 24 Oct 2012 17:23:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933556#M88387</guid>
      <dc:creator>emreka82</dc:creator>
      <dc:date>2012-10-24T17:23:01Z</dc:date>
    </item>
    <item>
      <title>Yes, you should have added a</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933557#M88388</link>
      <description>Yes, you should have added a default initialization for pp to NULL() as was done for other pointer components. The DEALLOCATE will set it to null automatically.</description>
      <pubDate>Wed, 24 Oct 2012 17:30:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933557#M88388</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2012-10-24T17:30:46Z</dc:date>
    </item>
    <item>
      <title>Quote:Steve Lionel (Intel)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933558#M88389</link>
      <description>&lt;BLOCKQUOTE&gt;Steve Lionel (Intel) wrote:&lt;BR /&gt;&lt;P&gt;Yes, you should have added a default initialization for pp to NULL() as was done for other pointer components. The DEALLOCATE will set it to null automatically.  &lt;/P&gt;&lt;/BLOCKQUOTE&gt;

Steve,

Then, where do I need ASSOCIATE declaration inside my code, is it necessary ? More importantly, can it solve my "invalid data type" problem ? 
Thanks.

Emre</description>
      <pubDate>Thu, 25 Oct 2012 11:55:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933558#M88389</guid>
      <dc:creator>emreka82</dc:creator>
      <dc:date>2012-10-25T11:55:54Z</dc:date>
    </item>
    <item>
      <title>Steve's suggestion was to</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933559#M88390</link>
      <description>Steve's suggestion was to replace the invalid statement [fortran]if(root%prnt%ng(1)%pp /= 0)[/fortran] with [fortran]if(associated(root%prnt%ng(1)%pp))...[/fortran].&lt;BR /&gt;
Whether this change will enable your code to function properly, however, is not something that one can answer, given the fragmentary view that has been divulged.</description>
      <pubDate>Thu, 25 Oct 2012 13:30:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933559#M88390</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2012-10-25T13:30:50Z</dc:date>
    </item>
    <item>
      <title>Quote:mecej4 wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933560#M88391</link>
      <description>&lt;BLOCKQUOTE&gt;mecej4 wrote:&lt;BR /&gt;&lt;P&gt;Steve's suggestion was to replace the invalid statement &lt;PRE class="brush: fortran"&gt;if(root%prnt%ng(1)%pp /= 0)&lt;/PRE&gt; with &lt;PRE class="brush: fortran"&gt;if(associated(root%prnt%ng(1)%pp))...&lt;/PRE&gt;.&lt;BR /&gt;&lt;BR /&gt;
Whether this change will enable your code to function properly, however, is not something that one can answer, given the fragmentary view that has been divulged.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;

Thanks mecej, I have a minor problem besides these, for example:
In c++:
if(*root-&amp;gt;type==out &amp;amp;&amp;amp; intersect==2)
				{	*root-&amp;gt;type=split;
				}

and out and split are the enumerated types, such as: enum ctype { out, cut, inside, split};

In Fortran, the following works for the first line, but it does not work inside the if clause :

if(associated(root%type_%out) .and. intersect==2) then
					associated(root%type_%split)
				end if

The problems are the enumerated filetypes and "*root-&amp;gt;type=split" inside the if clause. Thanks again.</description>
      <pubDate>Tue, 30 Oct 2012 07:47:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933560#M88391</guid>
      <dc:creator>emreka82</dc:creator>
      <dc:date>2012-10-30T07:47:03Z</dc:date>
    </item>
    <item>
      <title>In Fortran, an expression by</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933561#M88392</link>
      <description>In Fortran, an expression by itself does not form a valid statement. That is the error in your second line,[fortran]associated(root%type_%split)[/fortran]
Because you have only shown code fragments (in particular, the data type mapping from C to Fortran is not shown completely), it is not feasible for me to guess what you wish to accomplish. If you want to associate a pointer variable, you have to follow the appropriate Fortran syntax. ASSOCIATED() is a function of type logical.</description>
      <pubDate>Tue, 30 Oct 2012 11:41:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933561#M88392</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2012-10-30T11:41:14Z</dc:date>
    </item>
    <item>
      <title>Quote:mecej4 wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933562#M88393</link>
      <description>&lt;BLOCKQUOTE&gt;mecej4 wrote:&lt;BR /&gt;
.......Because you have only shown code fragments (in particular, the data type mapping from C to Fortran is not shown completely), it is not feasible for me to guess what you wish to accomplish. ...&lt;/BLOCKQUOTE&gt;

First of all, the codes that I try to write down are very long but there are troublesome "tricky" points inside some of the codes, which are discussed here. My example starts inside the  datastructure class, a enumeration type, as I said before:

C++:

[cpp]
//datastr.h:

#ifndef DATASTR
#define DATASTR

enum ctype { out, cut, in, split};
// continues...

class c 
{	public:

// continues...

ctype	*type;
int		*sq_i;

// continues...

};

#endif

[/cpp]

[cpp]

//mg.h

#ifndef MG
#define MG


using namespace std;

#include "datastr.h"

class mg : public c
{		
		public:
// continues...

c	*root;
// continues...

};

#endif
[/cpp]

[cpp]
// sq_i.cpp

#include "mg.h"


void mg::sq_i(c *nov)

// continues...

int intersec(0);

if (*nov-&amp;gt;type==out &amp;amp;&amp;amp; intersec&amp;gt;2)
{
exit(EXIT_FAILURE);
	}
else
	{	*nov-&amp;gt;type=split;
		*nov-&amp;gt;sq_i=-40;
	}

// continues...

}
[/cpp]

[cpp]
// create.cpp

#include "mg.h"

void mg::create()

{
root = new c;
// continues...
sq_i(root);
// continues...
}

[/cpp]

I am trying to write in Fortran form.

Fortran:

[fortran]

module class_datastr

    
    type ctype
    
        integer, pointer :: out, cut, in, split
            
    end type ctype

! continues...

type c

! continues...

type(ctype),	pointer :: type_
integer,		pointer :: sq_i

! continues...

end type c

end module class_datastr

[/fortran]

[fortran]

module class_mg

use class_datastr

! continues...

type(c), pointer :: root

! continues...

end module class_mg

[/fortran]

[fortran]
recursive subroutine mg_sq_i(nov)

use class_mg

type(c), pointer :: nov 

! continues...

integer intersec

! continues...

if(associated(nov%type_%out) .and. intersec&amp;gt;2) then

exit

else

associated(nov%type_%split)
nov%sq_i=-40
	
end if

! continues...

end subroutine sq_i

[/fortran]


[fortran]
subroutine mg_create
    
use class_mg

allocate(root)

! continues...

call sq_i(root)

! continues...

end subroutine mg_create

[/fortran]

Above, I write some parts of the modules(classes) and subroutines, selected from my codes.
 The problem is the *nov-&amp;gt;type=split; line inside the create.cpp code. I wish you understand the issue here. Thanks for the effort mecej.</description>
      <pubDate>Tue, 30 Oct 2012 12:48:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/This-binary-operation-is-invalid-for-this-data-type-but-why/m-p/933562#M88393</guid>
      <dc:creator>emreka82</dc:creator>
      <dc:date>2012-10-30T12:48:17Z</dc:date>
    </item>
  </channel>
</rss>

