James Giles wrote:
> [log in to unmask] wrote:
> ...
> > Yes, but it introduces new problems when there is no obvious
> > way to correct a "mistake" do to this promotion.
> >
> > Things like
> > call expects_a_single_precision_arg (3.14)
> > or
> > call expects_a_single_precision_arg (3.14*single_prec_variable)
> > or
> > single_prec = max(single_prec, 1.0)
> >
> > For good or for bad, Fortran has a ton of rules about what types
> > can be used where and what the results of mixed type operations
> > are, and trying to change (or even improve) them will make old
> > programs fail in strange ways.
>
> Well, of course "old programs" won't use the new syntax that says
> to assume all KINDless literals are of some particular precision.
Umm, Yes and no. Old programs are often modified as time goes along.
Adding new syntax like IMPLICIT NONE to an old program as part of the
enhance/modify/maintain/fool-around-with cycle is a good thing to do
because it detects potential bugs at compile time. Adding syntax
like IMPLICIT TREAT ALL REAL LITERALS AS DOUBLE is riskier
because it could silently break something that works. Sure, everybody
who modifies a program should read the whole thing through and
understand everything, but ....
I think adding some sort of default literal to Fortran is a very
good idea and it's too bad it didn't happen earlier. It's just not
trivial to do it in a way that is reasonably consistent with the
way people code in real life.
Dick Hendrickson
|