🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.fortran
Article #4577

Structure and Data Statement Usage

#4577
From: Frederick R. Phelan Jr.
Date: Fri, 08 Jan 1993 18:04
70 lines
1739 bytes
Heres a small code prototype of my problem:

      program test_35

      structure /geom/
        integer ngprops
      end structure
      record /geom/ g1,g2

c     uncomment these for compiler havoc
c      data g1.ngprops /3/
c      data g2.ngprops /5/

c     these are ok when uncommented
c     g1.ngprops=3
c     g2.ngprops=5

      write(*,1000) g1.ngprops
 1000 format('g1=',i2)
      write(*,1001) g2.ngprops
 1001 format('g2=',i2)

      stop
      end

Ok, so I have a structure, and I want to initialize
g1.ngprops and g2.ngprops to differnent values.

Compiling with the data statements uncommented gives:

        f77 test_35.f -o test_35.exe
Error on line 6 of test_35.f: syntax error
Error on line 6 of test_35.f: syntax error
*** Error code 1

Stop.


Note: The record statement is line 6.  

The program works ok with the lines 

     g1.ngprops=3
     g2.ngprops=5

uncommented.

I know you can say:

      structure /geom/
        integer ngprops /5/
      end structure

but then g1.ngprops and g2.ngprops are initialized to the same 
value.

How can you use structure variables in data statements?

Fred
---
Fred Phelan
fred@poly2.nist.gov


PS: This is on a Silicon Graphics machine.

PPS: Anyone care to comment on how common f77 extensions
     like structures have become on other platforms? I'll
     summarize if there is sufficient replies and/or
     interest.
Technical Details
Message-ID: <7876@dove.nist.gov>
Path: arc1-ca.pugleaf.net!sparky!uunet!dove!poly2.nist.gov!fred

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!dove!poly2.nist.gov!fred
From: fred@poly2.nist.gov (Frederick R. Phelan Jr.)
Newsgroups: comp.lang.fortran
Subject: Structure and Data Statement Usage
Message-ID: <7876@dove.nist.gov>
Date: 8 Jan 93 18:04:15 GMT
Sender: news@dove.nist.gov
Lines: 72