This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Variable Expression Formats


Actually, g77 only has half-hearted support for this feature.

It really needs to be improved in order to be compatible with
code being ported from Lahey (lf95), Portland Group (pgf77),
Sun (f77), Intel (ifort) and the vast legacy of VAX-compatible
Fortran compilers and the stable Fortran code base handed
down from DEC to Compaq to HP to, finally, Intel.

The attached code will compile with all of the above-mentioned
compilers.  If you give it the input shown below, it will produce
the following output:

$ varexpfmt
 Input value:
1.23456789
 Output width:
6
 Output precision:
3
 Output value:  1.235
$

If you use g77, the compiler barfs:

$ g77 ./varexpfmt.f
./varexpfmt.f: In program `varexpfmt':
./varexpfmt.f:12: 
    700  format(1x,'Output value:',1x,f<w>.<p>)
                                      ^
Variable-expression FORMAT specifier at (^) -- unsupported
./varexpfmt.f:12: 
    700  format(1x,'Output value:',1x,f<w>.<p>)
                                      ^
Variable-expression FORMAT specifier at (^) -- unsupported
$

--
Eskandar Ensafi
Space Computer Corporation

----- Original Message ----- 
From: "Steve Kargl" <sgk@troutmask.apl.washington.edu>
To: "Eskandar Ensafi" <Ensafi@SpaceComputer.Com>
Cc: <fortran@gcc.gnu.org>
Sent: Thursday, May 13, 2004 1:18 PM
Subject: Re: Variable Expression Formats


> On Thu, May 13, 2004 at 12:15:29PM -0700, Eskandar Ensafi wrote:
> > Hello,
> > 
> > Will GNU Fortran 95 support variable expressions in format statements?
> > I know that this does not conform to the Fortran standard, but it is a
> > fairly popular extension and a very useful feature.
> > 
> 
> If g77 supports this feature, then gfortran will also support it.
> Do you have a small test case that you can post?
> 
> -- 
> Steve
>

Attachment: varexpfmt.f
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]