Re: Can an intrinsic function be replaced in FTN95



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
.



Relevant Pages

  • Re: Is C99 the final C? (some suggestions)
    ... > that someone will try compile their stuff on an old compiler. ... > because the ANSI standard obsoleted them, and everyone picked up the ANSI ... fixed by using another language. ... >>are multiplying two expressions of the widest type supported by your ...
    (comp.lang.c)
  • Re: Statement on Schildt submitted to wikipedia today
    ... to working programmers and more with being "right all the time, ... so that compiler developers could be shed ... The major corporate interests were compiler developers, ... processors, committed to standard division semantics, and otherwise ...
    (comp.lang.c.moderated)
  • Re: #define and (brackets)
    ... Minor compiler vendors are free to join if they are so inclined, ... analysis hasn't changed between the two versions of the standard. ... This bug is a minor bug in an obscure ...
    (microsoft.public.vc.language)
  • Re: interesting use of NEXT SENTENCE vs. CONTINUE
    ... Program name in quotes (allowed in '02 Standard) ... > If J can be made an independent item which the compiler can put wherever it ... > has to be associated with a hardware device in SPECIAL-NAMES. ... > that ALTER *always* modifies the address parameter of the hardware branch ...
    (comp.lang.cobol)
  • Re: interesting use of NEXT SENTENCE vs. CONTINUE
    ... These days I don't do compiler maintenance, but I HAVE done in the past, so ... You had a chance to point out how adherence to the standard can improve ... >> compile it WITH MINOR MODIFICATIONS for a specific platform. ... > platform-specific extension to COBOL ...
    (comp.lang.cobol)