Using legacy .or code

In the earlier fortran code, when .or. used with two integer types, is it the result of bit-wise or operands or 0/1?

I am updating outdated code and believe that I should replace these .or. instances .or. on IOR , but not sure if this is the expected result in older code. Should I instead set the result to 0 or 1?

+4
source share
2 answers

I believe that what you see is really a user extension. I have not seen this before, but I found a link on the Internet about such things that really exist in nature:

When Fortran programs interact directly with digital equipment, bit logic operations with bit patterns may be required. The standard Fortran does not provide a direct way to do this, since logical variables essentially store only one bit of information, and integer variables can only be used for arithmetic. Many systems provide, as an extension, internal functions for performing bitwise operations with integers. Function names are different: usually it is IAND, IOR, ISHIFT. Several systems provide normal logical operators such as .AND. and .OR. for use with integer arguments : this is a much more radical extension and much less satisfactory, not only because it reduces portability, but also reduces the ability of the compiler to detect errors in ordinary arithmetic expressions.

Link

+6
source

Compilers with DEC / VMS or legacy references support the extension of resolving integer arguments to .OR. (and other logical operators). This group of compilers defines .OR. working on integers like a bit.

The currently supported compiler with this legacy is Intel Fortran (via Compaq Fortran, via Digital Fortran, etc.).

+1
source

All Articles