next up previous 252
Next: POINTERS on Alphas
Up: DEC Unix
Previous: General

LOGICAL Values

One place where the DEC system may differ from the Sun is in how logical values are handled. The original FORTRAN compiler for the DECstation (FORTRAN for RISC) used the Sun interpretation of logical values, i.e. zero is false, non-zero is true. The more recent DEC FORTRAN compiler uses the VMS convention that only checks the lowest bit of a value, so 0 is false, 1 is true, 2 is false, 3 is true, etc. When DEC FORTRAN sets a LOGICAL variable to TRUE, all the bits in the data are set to 1, resulting in a numerical equivalent value of -1. Unfortunately this means that the correct value of the macros F77_ISFALSE and F77_ISTRUE used in a C function, depend on which FORTRAN compiler you are using. It is not possible to handle this automatically, so you must be sure to use the right values for the macros. The default assumption is that you are using the newer DEC FORTRAN compiler. Fortunately this is unlikely to be a problem in practice, since a TRUE value will normally be 1 or -1, and these values will be handled correctly by either compiler.



next up previous 252
Next: POINTERS on Alphas
Up: DEC Unix
Previous: General

CNF and F77 Mixed Language Programming -- FORTRAN and C
Starlink User Note 209
P.M. Allan
A.J. Chipperfield
R.F. Warren-Smith
19 January 2000
E-mail:ussc@star.rl.ac.uk