next up previous contents index
Next: Guidelines Up: Arithmetic Expressions Previous: Arithmetic Constant Expressions

Bit-wise Logical Operations on Integers

  When Fortran programs communicate directly with digital hardware it may be necessary to carry out bit-wise logical operations on bit-patterns. Standard Fortran does not provide any direct way of doing this, since logical variables essentially only store one bit of information and integer variables can only be used for arithmetic. Many systems provide, as an extension, intrinsic functions to perform bit-wise operations on integers. The function names vary: typically they are IAND, IOR, ISHIFT. A few systems provide allow the normal logical operators such as .AND. and .OR. to be used 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 normal arithmetic expressions.

Many systems also provide format descriptors to transfer integers using octal and hexadecimal number bases: these are also non-standard.



Mario Storti
Wed Nov 4 19:32:56 ART 1998