LOGICAL objects follow exactly the same principle as for numeric data types. Even though a LOGICAL variable can only hold one of two values it can still be represented in a number of different ways. For example,
LOGICAL(KIND=4) :: yorn = .TRUE._4 LOGICAL(KIND=1), DIMENSION(10) :: mask IF (yorn .EQ. LOGICAL(mask(1),KIND(yorn))) ....
KIND=1 could mean that only one byte is used to store each element of mask which would conserve space. Must refer to the compiler manual.
Figure 28: Possible Sizes of Different Logical Kind Variables
There is no SELECTED_LOGICAL_KIND intrinsic, however, the KIND intrinsic can be used to inquire about the representation and, as demonstrated above, the LOGICAL intrinsic, which has an optional KIND= argument, can be used to convert between representations.
Return to corresponding overview page