Re: Can an intrinsic function be replaced in FTN95
- From: nospam@xxxxxxxxxxxxx (Richard Maine)
- Date: Mon, 26 Feb 2007 09:40:36 -0800
FTN95_USER <ftb_95_user@xxxxxxxxxxx> wrote:
I have a 100,000 line program that was wriiten to meet FTN90 standards. I have
to compile and run it on a system using FTN95. Under FTN95, the function sign
behaves differently than under FTN90. I can fix it by writing my own sign
function, but I need to know if there is a way to make FTN95 use my verson of
sign as opposed to the version built into FTN95.
I assume you must be talking about the issue of signed zeros. That's the
only area where I can imagine a difference there. I forget the details
of what the standards said on the subject. I'd have been leery of
depending overly much on the behavior of signed zeros, since the
standard doesn't guarantee that such things even exist. For floating
point (but not integer), signed zeros do exist on most (all?) current
systems, but the standard tries to stay neutral on the subject. There
have been changes in this area as the standard tries to be more
accomodating to systems with signed zeros.
If you aren't talking about signed zeros, then I have no idea what you
mean.
In any case, yes, you can easily substitute your own procedure for any
intrinsic. If your procedure is a module procedure, you don't need to do
anything special at all; it should just happen. If you have a
100,000-line program in f90, you should probably be using modules
anyway.
If your procedure is an external procedure, you need to declare it as an
external in any of several ways: an external statement, the external
attribute in a type declaration statement, or an interface body. Since
at least f77, the standard has explicitly recommended using such
explicit declarations for user external procedures. That is a way to
avoid having a programchange meaning if you run it on a compiler that
happens to have an intrinsic of the same name - either a
compiler-specific intrinsic or one added by a newer version of the
standard. The same mechanism works to replace an intrinsic by something
of your own choosing.
If you use sign with multiple precisions, you'll need to make a generic,
but that''s done the same way as any other generic.
The precise rules for how the standard chooses what version to use turn
out to be quite complicated. I can't remember them. The only way I can
work with them is to put a copy in front of me and work through it line
by line. But fortunately, you never really need to know the precise
rules unless you are a compiler writer or tester. For your purposes, the
simple version is that if you declare your procedure, the compiler wil
use it.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.
- Follow-Ups:
- Re: Can an intrinsic function be replaced in FTN95
- From: FTN95_USER
- Re: Can an intrinsic function be replaced in FTN95
- References:
- Can an intrinsic function be replaced in FTN95
- From: FTN95_USER
- Can an intrinsic function be replaced in FTN95
- Prev by Date: Re: Can an intrinsic function be replaced in FTN95
- Next by Date: Re: Can an intrinsic function be replaced in FTN95
- Previous by thread: Re: Can an intrinsic function be replaced in FTN95
- Next by thread: Re: Can an intrinsic function be replaced in FTN95
- Index(es):
Relevant Pages
|