Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

boolean/integer(bool)/logical

wkramer
Beginner
6,639 Views
Under issue number 279810 I reported to premier support that according to "Help Win32* Routines" the equivalent fortran data type for Win32 BOOL or BOOLEAN is LOGICAL(4), the passage can be found in the documentation:"Intel Visual Fortran CompilerUser's GuideUsing LibrariesUsing the Win32 RoutinesCalling Win32* Routines"
Issue status is "reproduced(escalated)", but nothing has been done since (issue submitted dec 2004), the same passage can still be found now under:"Intel Visual Fortran CompilerBuilding ApplicationsUsing LibrariesUsing the Windows API RoutinesCalling Windows API Routines"
Walter Kramer
I did press reply to get this meessage in the IVF versus CVF thread, but something must have gone wrong????

Message Edited by WKRAMER on 10-19-2005 02:06 PM

0 Kudos
24 Replies
Steven_L_Intel1
Employee
1,470 Views
Interesting idea...
0 Kudos
emc-nyc
Beginner
1,470 Views
Because it's outside the defined standard behavior, so compiler writers can do anything they want, including bit-wise comparisons, treating it like



aLogical .and. bLogical



or considering it to be a syntax error and refusing to compile it.

If both values are generated entirely within Fortran, without using transfer or equivalence, the use of .eq. would almost certainly be safe.

I will also say that in 30 years of Fortran programming, I've yet to use the .eqv. operator. I've just never run into a situation where I wanted to do the same thing if two logicals both true or both false. Writing
aLogical .eqv. .true.

has always struck me as pointless.

Message Edited by emc-nyc on 10-21-2005 08:01 PM

0 Kudos
sabalan
New Contributor I
1,470 Views

Steve alias Dr. Fortran,

What about the following code? Is it correct?

HAPPENED = .True.

IF (A > B .AND. HAPPENED) Then

do something...

Regards,

Sabalan.

0 Kudos
Steven_L_Intel1
Employee
1,470 Views
Following the precedence rules,

 (A > B .AND. HAPPENED)

is treated as if it were:
 ((A > B) .AND. HAPPENED)

since .AND. has a lower precedence than >

The Doctor's advice is the same, however. Put in the parentheses so you (and the compiler) don't have to guess what the meaning is.
0 Kudos
Reply