- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The specific issue I have at the moment is statements like:
if(i .gt. 0 .and. array(i) .gt. 10.0) then ...
if the first bit is false, it doesn't need to evaulate the second bit, in fact it must not, as it will fail with full checking on.
Adrian
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Fortran language does not have short-circuit evaluation nor does it specify order of evaluation for logical operands. The compiler chooses order based on optimization criteria (register pressure, etc.)
What you should do is use IF-THEN to nest the conditions the way you want. Then you will not be subject to the whim of the compiler and your code will be more portable.
What you should do is use IF-THEN to nest the conditions the way you want. Then you will not be subject to the whim of the compiler and your code will be more portable.

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