Adriaan Joubert writes:
> >
> > > > If you have allocation/deallocation in subroutines it is much safer to
> > > > use automatic arrays.
> >
> > > There's no way to detect that allocation of automatic arrays failed, so
> > > you always get a crash in that case. For robustness, use allocatable.
> > > At least there, you have a STAT variable that you can check for failure,
> > > and then cope with it some other way, or terminate the program gracefully
> > > and with informative error messages.
> >
> > In fact, automatic arrays are far more *convenient*, but far less *safe*,
> > since, as Van said, there's no way to detect an allocation failure
> > (usually a stack overflow) in this case. I know -- I've been there.
> >
>
> I still believe that, from a programming point of view, automatic arrays
> are much neater than allocate/deallocate statements. I ran into the
> stack overflow problem right in the first beta of DEC Fortran and since
> then we tend to have our stack sizes set to 1-2 GB ;-) Not the ideal
> solution, but no stack overflows until you run out of virtual memory.
>
> I do, however, feel that this is an excellent reason to sort out
> exception handling in Fortran 90. I have been rejecting C++ for
> numerical computations and cope with the awkward interface between C++
> and F90 just to be able to write all my numerical code in Fortran 90.
Are you implying that you know how to call F90 routines from C++? If
so, could you tell me how you do that. Is the technique portable
across platforms?
thanks,
robert
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|