diff options
author | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-01-13 19:53:16 +0000 |
---|---|---|
committer | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-01-13 19:53:16 +0000 |
commit | ad64ae1c02f6d0d0280c72c975d3e56ddbafe528 (patch) | |
tree | bf815e2471d2b7f7e44d76a31e98cc1d05e07b34 /gcc/fortran/gfortran.texi | |
parent | 2d9cba1ec16cd7cb27b2a61f38675be328d9c708 (diff) |
Revert r244448
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244454 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/gfortran.texi')
-rw-r--r-- | gcc/fortran/gfortran.texi | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi index 1a36dd7b80d..9a263171e47 100644 --- a/gcc/fortran/gfortran.texi +++ b/gcc/fortran/gfortran.texi @@ -3810,42 +3810,12 @@ front ends of GCC, e.g. to GCC's C99 compiler for @code{_Bool} or GCC's Ada compiler for @code{Boolean}.) For arguments of @code{CHARACTER} type, the character length is passed -as a hidden argument at the end of the argument list. For -deferred-length strings, the value is passed by reference, otherwise -by value. The character length has the C type @code{size_t} (or -@code{INTEGER(kind=C_SIZE_T)} in Fortran). Note that this is -different to older versions of the GNU Fortran compiler, where the -type of the hidden character length argument was a C @code{int}. In -order to retain compatibility with older versions, one can e.g. for -the following Fortran procedure - -@smallexample -subroutine fstrlen (s, a) - character(len=*) :: s - integer :: a - print*, len(s) -end subroutine fstrlen -@end smallexample - -define the corresponding C prototype as follows: - -@smallexample -#if __GNUC__ > 6 -typedef size_t fortran_charlen_t; -#else -typedef int fortran_charlen_t; -#endif - -void fstrlen_ (char*, int*, fortran_charlen_t); -@end smallexample - -In order to avoid such compiler-specific details, for new code it is -instead recommended to use the ISO_C_BINDING feature. - -Note with C binding, @code{CHARACTER(len=1)} result variables are -returned according to the platform ABI and no hidden length argument -is used for dummy arguments; with @code{VALUE}, those variables are -passed by value. +as hidden argument. For deferred-length strings, the value is passed +by reference, otherwise by value. The character length has the type +@code{INTEGER(kind=4)}. Note with C binding, @code{CHARACTER(len=1)} +result variables are returned according to the platform ABI and no +hidden length argument is used for dummy arguments; with @code{VALUE}, +those variables are passed by value. For @code{OPTIONAL} dummy arguments, an absent argument is denoted by a NULL pointer, except for scalar dummy arguments of type |