Re: DATA statement to initialise arrays
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: DATA statement to initialise arrays         

Group: comp.lang.fortran · Group Profile
Author: dpb
Date: Sep 19, 2008 07:25

bru wrote:
> Hello,
>
> I'm using Sun f77 and pgf77 compiler and both the following
> sequences does not work!! (It comes from a legacy code)
>
> PARAMETER (NTRMAX=50)
> LOGICAL LOST(NTRMAX)
> DATA LOST / NTRMAX*(.FALSE.)
>
>
> PARAMETER(MXL= 10, MXD= 10)
> DIMENSION NEwVAL(MXL,MXD)
> / DATA NEWVAL / (MXL*MXD)*0/
>
> which is the standard writing for those DATA statements?

DATA LOST / NTRMAX* .FALSE.

The second would be

DATA NEWVAL / MXL*MXD *0 /

if initialization expressions allowed "*", but they don't.

Note the common thread there is the parentheses aren't allowed.

I thought there was a chance that SIZE(NEWVAL)*0 would work under F95,
but at least CVF barfed on it.

For F77 w/o a compiler-specific extension you'll unfortunately have to
either write the value of MXL*MXD as a constant as well.

PARAMETER(MXL= 10, MXD= 10, NMXLD=100)
DATA NEWVAL / NMXLD * 0 /

--
no comments
diggit! del.icio.us! reddit!