Vax C90-EL SERIES Service Manual Page 148

  • Download
  • Add to my manuals
  • Print
  • Page
    / 216
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 147
Cray Standard C/C++ Reference Manual
which they are declared and referenced in Fortran. Arrays are zero-based in C
and C++ and are one-based in Fortran, so in C and C++ you should subtract 1
from the array subscripts that you would normally use in Fortran.
For example, using the Fortran declaration of array A in the preceding example,
the equivalent declaration in C or C++ is:
int a[2][3];
The following list shows how to access elements of the array from Fortran and
from C or C++:
F
ortran C or C++
A(1,1) A[0][0]
A(2,1) A[0][1]
A(3,1) A[0][2]
A(1,2) A[1][0]
A(2,2) A[1][1]
A(3,2) A[1][2]
9.3.4 Logical and Character Data
Logical and character data need special treatment for calls between C or C++ and
Fortran. Fortran has a character descriptor that is incompatible with a character
pointer in C and C++. The techniques used to represent logical (Boolean) values
also differ between Cray Standard C, C++, and Fortran.
Mechanisms you can use to convert one type to the other are provided by the
standard header file and conversion utilities shown in the following list:
H
eader file or
utility
Description
<fortran.h> Header file that defines the type _fcd, which
maps to the Fortran character descriptor and
defines or declares the macros or functions
contained in this list.
_cptofcd Conversion utility that converts a C or C++
character pointer to a Fortran character descriptor.
_fcdtocp Conversion utility that converts a Fortran
character descriptor to a C or C++ character
pointer.
128 S217936
Page view 147
1 2 ... 143 144 145 146 147 148 149 150 151 152 153 ... 215 216

Comments to this Manuals

No comments