- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
I have a Fortran code with extensive use of .AND. It has been used with the assumption that the second condition is evaluated only if the first condition is true. For e.g.
L= 0
IF (L !=0 .AND. ARRAY(L) > 1.0) THEN
DO SOMETHING
ENDIF
The code executes without problems when compiled with Compaq Visual Fortran compiler but not with Intel Fortran 8.0. Does the Intel compiler not always evaluate the first condition before the second?
Thanks,
Bhanu
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Fortran language allows compilers to evaluate this or any equivalent expressionin any order it sees fit, as long as parentheses are obeyed. You just got lucky before - your code is incorrect.
Use nested IF-THEN instead.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page