- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Ineed to define a parameter(MMAX), with an argument from a subroutine (DISCR_PTS). With it I can afterwards define other variables ( A(NMAX,NMAX) ). The code looks like this:
subroutine MIN(DISCR_PTS)
INTEGER MMAX
PARAMETER (MMAX=DISCR_PTS)
real*8 A(NMAX,NMAX)
I get the following:
Error: This symbol must be a defined parameter or an argument of an inquiry function that evaluates to a compile-time constant. [DISCR_PTS]PARAMETER (MMAX=DISCR_PTS)
I cannot change how A is defined because it is info for a library. DISCR_PTS is an integer defined in an include file.
Can anyone give me a hint on how to solve this?
Thanks, Daniel
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The simple answer is to just use the dummy argument DISCR_PTS to dimension your array(s) As long as they are local to the subroutine the arrayswill be allocated automatically (and deallocated on exit from the subroutine)
I have in the past,come across stack overflow with automatic arrays for large values ofDISCR_PTS (well my version of it anyway) and so did an explicit allocate(a(discr_pts,discr_pts),stat=istat) for each array at the start of the subroutine.
Les
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page