Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

pointers and LIFO stack

fabriziofattor
Beginner
966 Views
In Visual Fortran 6.1 environment, I can't use pointersto developea LIFO stack of type data (a number, astring anda pointer to next data) likeI use in Pascal or C.Standard POINTER, TARGET and new Fortran 90/95 pointer features aren't suitable for a such simple problem. Do I needto use a mixed language? Thanks
0 Kudos
3 Replies
Steven_L_Intel1
Employee
966 Views
Why not? What goes wrong?

Do be aware that you are using a compiler that is six years old.
0 Kudos
fabriziofattor
Beginner
966 Views
It's not a compiler problem. Probably it's a matter of my pointer's idea (and code too). Reading an input free format text file I describe a building or bridge (I need to analyse their dynamic behaviour on wind load with a finite element fortran written program). I don't know "a priori" how many points are in the structure, so I need to read the input file and create a list of element (then, before the computation, I allocate an array with right dimension). In CVF, I think, it's necessary allocate the target array (and pointer too), but I don't know dimension at the beginning of elaboration. In Pascal and C, each data element (type data) is allocated when needed and linked to previous element (the last in the list). Isthat possible also in CVF? Thank you.
0 Kudos
Steven_L_Intel1
Employee
966 Views
Certainly it's possible in Fortran, and you'd do it the same way you would in Pascal or C - by allocating each "link" as needed, rather than an array all at once. In the old version you're using, you will have to use POINTER rather than ALLOCATABLE for the link to the next (or previous) element.
0 Kudos
Reply