There is a simple correspondence between VAX FORTRAN and VAX C numeric variable types. The standard types are given in the upper part of the table below and non-standard extensions in the lower part. These should generally be avoided for reasons of portability. However, they are provided since HDS has corresponding data types.
Although VAX C defines unsigned data types of unsigned char (range 0 to 255), unsigned short (range 0 to 32767) and unsigned int (range 0 to ), there are no corresponding unsigned data types in FORTRAN. There is also a C type called long int; however in VAX C, this is the same as an int.
The C language does not specify whether variables of type char should be stored as signed or unsigned values. On VMS, they are stored as signed values in the range -128 to 127.
Similarly there is no C data type that corresponds to the FORTRAN data type of COMPLEX. However, since VAX FORTRAN passes all numeric variable by reference, a COMPLEX variable could be passed to a VAX C subprogram where it might be handled as a structure consisting of two variables of type float.
A VAX FORTRAN LOGICAL value can be passed to a VAX C int, but care must be taken over the interpretation of the value since VAX FORTRAN only considers the lower bit of the longword to be significant (0 is false, 1 is true) whereas VAX C treats any numerical value other than 0 as true. When VAX FORTRAN sets a logical value to true, it sets all the bits. This corresponds to a numerical value of minus one.
CNF and F77 Mixed Language Programming -- FORTRAN and C