From: James Tursa on
The non-standard %LOC() and %VAL() constructs are available in the
Intel Fortran and Compaq Fortran compilers that I have (32-bit,
WinXP). Are these constructs available in other compilers such as
gfortran, f95, etc? What about linux, mac, etc.? If not, is there a
workaround for this functionality? I am writing a package for others
to use and would like it to run in other environments out of the box
if possible. Thanks.

James Tursa
From: steve on
On Nov 24, 10:30 am, James Tursa <aclassyguywithakno...(a)hotmail.com>
wrote:
> The non-standard %LOC() and %VAL() constructs are available in the
> Intel Fortran and Compaq Fortran compilers that I have (32-bit,
> WinXP). Are these constructs available in other compilers such as
> gfortran, f95, etc? What about linux, mac, etc.? If not, is there a
> workaround for this functionality? I am writing a package for others
> to use and would like it to run in other environments out of the box
> if possible. Thanks.
>
> James Tursa

See the gfortran documentation for information concerning its
implementation of these constructs.

--
steve
From: glen herrmannsfeldt on
James Tursa <aclassyguywithaknotac(a)hotmail.com> wrote:

> The non-standard %LOC() and %VAL() constructs are available in the
> Intel Fortran and Compaq Fortran compilers that I have (32-bit,
> WinXP). Are these constructs available in other compilers such as
> gfortran, f95, etc? What about linux, mac, etc.? If not, is there a
> workaround for this functionality? I am writing a package for others
> to use and would like it to run in other environments out of the box
> if possible. Thanks.

These came with VAX (yes VAX, not VMS) that tried to define standard
calling conventions. They defined call by value, reference, and
descriptor. Each compiler would use the appropriate method, with
%val(), %ref(), and %descr() allowing one to override the default.
(Especially useful for interlanguage calling).

With assumed shape arrays, Fortran needs a call by descriptor method
to pass the array information. Fortran 2003 added call by value,
possibly related to the C interoperability feature to be able
to call C routines expecting call by value. C interoperability
also adds C_LOC(), which gives a C pointer to a data item.

Compilers with some connection to DEC, or trying to be compatible
with programs written for VAX might implement %LOC() and %VAL().

-- glen
From: Richard Maine on
steve <kargls(a)comcast.net> wrote:

> On Nov 24, 10:30 am, James Tursa <aclassyguywithakno...(a)hotmail.com>
> wrote:
> > The non-standard %LOC() and %VAL() constructs are available in the
> > Intel Fortran and Compaq Fortran compilers that I have (32-bit,
> > WinXP). Are these constructs available in other compilers such as
> > gfortran, f95, etc? What about linux, mac, etc.? If not, is there a
> > workaround for this functionality? I am writing a package for others
> > to use and would like it to run in other environments out of the box
> > if possible. Thanks.
>
> See the gfortran documentation for information concerning its
> implementation of these constructs.

I don't have any kind of handy list, but there are certainly plenty of
compilers that do not accept these constructs. I've used many such in
the past. How many of those compilers are current ones or ones that your
particular users are likely to run into I couldn't say. I haven't kept
track, largely because I've never considered those constructs portable
enough to use in my own code.

As for "workarounds", I'd suggest looking at the f2003 C interop
facilities. Those are implemented in many f95 compilers. I'd personally
tend to consider the %loc and %val stuff as more like workarounds for
lack of f2003 C interop support in some compilers. You might keep in
mind my guess that the prevalance of support for the f2003 C interop
features is likely to increase with time, while support for %loc and
%val is likely to decrease.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
From: dpb on
James Tursa wrote:
> The non-standard %LOC() and %VAL() constructs are available in the
> Intel Fortran and Compaq Fortran compilers that I have (32-bit,
> WinXP). Are these constructs available in other compilers such as
> gfortran, f95, etc? What about linux, mac, etc.? If not, is there a
> workaround for this functionality? I am writing a package for others
> to use and would like it to run in other environments out of the box
> if possible. Thanks.
>
> James Tursa

Did you check the comparison pages at the Polyhedron site? IIRC it has
an "extensions supported" category for most compilers...

<www.polyhedron.com.uk> (otomh, I _think_ that's home page)

--