Message ID | 51379E8C.7090609@net-b.de |
---|---|
State | New |
Headers | show |
*ping* Tobias Burnus: > During the discussion of UNION, I decided to have a look at the > current documentation. UNION is not mentioned (except for some > commented lines), but record structures are. Attached is an attempted > to improve the documentation. > > The current version is at > http://gcc.gnu.org/onlinedocs/gfortran/STRUCTURE-and-RECORD.html > > I tested it with make pdf and make info and looked at the output. > OK for the trunk? > > Tobias
On Mon, Mar 11, 2013 at 06:39:37PM +0100, Tobias Burnus wrote: > *ping* > > Tobias Burnus: > > During the discussion of UNION, I decided to have a look at the > > current documentation. UNION is not mentioned (except for some > > commented lines), but record structures are. Attached is an attempted > > to improve the documentation. > > > > The current version is at > > http://gcc.gnu.org/onlinedocs/gfortran/STRUCTURE-and-RECORD.html > > > > I tested it with make pdf and make info and looked at the output. > > OK for the trunk? The patch looks ok to me. I wonder if the text should identify the vendor that introduced this feature as DEC. For the youngster on the list, DEC is the Digital Equipment Corporation.
2013-03-06 Tobias Burnus <burnus@net-b.de> * gfortran.texi (STRUCTURE and RECORD): State more clearly how to convert them into derived types. diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi index 462b443..4f9008d 100644 --- a/gcc/fortran/gfortran.texi +++ b/gcc/fortran/gfortran.texi @@ -2004,10 +2004,19 @@ code that uses them running with the GNU Fortran compiler. @cindex @code{STRUCTURE} @cindex @code{RECORD} -Structures are user-defined aggregate data types; this functionality was -standardized in Fortran 90 with an different syntax, under the name of -``derived types''. Here is an example of code using the non portable -structure syntax: +Record structures are a pre-Fortran-90 vendor extension to create +user-defined aggregate data types. GNU Fortran does not support +record structures, only Fortran 90's ``derived types'', which have +a different syntax. + +In many cases, record structures can easily be converted to derived types. +To convert, replace @code{STRUCTURE /}@var{structure-name}@code{/} +by @code{TYPE} @var{type-name}. Additionally, replace +@code{RECORD /}@var{structure-name}@code{/} by +@code{TYPE(}@var{type-name}@code{)}. Finally, in the component access, +replace the period (@code{.}) by the percent sign (@code{%}). + +Here is an example of code using the non portable record structure syntax: @example ! Declaring a structure named ``item'' and containing three fields: