If data are to be passed between routines that have been written in different
languages, then it is important that those languages represent the data in the
same way. The FORTRAN standard makes no statements about how any of the data
types should be implemented and there is almost nothing in the C standard
either. For example, if a certain bit pattern was interpreted as the integer
by FORTRAN, yet the same bit pattern was interpreted by C as
, then
there are going to be serious problems trying to communicate between routines
written in different languages. Fortunately, the hardware on which the program
is running provides a constraint for those data types that are implemented
directly in the hardware. For example, all reasonable computers have
instructions for operating on integers and it would be a particularly perverse
compiler writer who chose not to use the hardware representation. Something
that is slightly more likely to be a problem is the way that floating point
numbers are represented. If the hardware supports floating point arithmetic,
then you are in the same situation as for integers and all should be well.
However, if the hardware does not support floating point arithmetic, then there
could be problems. Some older PCs do not have floating point hardware, although
modern PCs either support floating point operations directly in hardware, or
there is a recognised way of representing floating point numbers that is
generally adhered to. The bottom line on numerical data types is that it is
most unlikely that different languages will represent the same number in a
different manner on the same hardware.
CNF and F77 Mixed Language Programming -- FORTRAN and C