Re: Q: Checking the size of a non-allocated array?



integer y(5)
integer, allocatable :: x(:)
!-----
call mysub(y) ! this call should be ok
call mysub(x) ! this call invokes size(x,1), which may not be

You might want to check if x is allocated before calling the routine:

if (allocated(x)) call mysub(x)

Note that you cannot check y in such a way, as it is not an
allocatable array.

Arno

.



Relevant Pages

  • Re: Q: Checking the size of a non-allocated array?
    ... this call invokes size, which may not be ... You might want to check if x is allocated before calling the routine: ... allocatable array. ... But is there any way, inside mysub, to legitimately check to ...
    (comp.lang.fortran)
  • Re: return from main
    ... start-up code performs whatever processing is needed prior to calling ... calling exit() from main invokes the functions ... and potentially also to the strings pointed to by the argv array. ...
    (comp.lang.c)
  • Re: Raising UI-level events from a thread without using Invoke?
    ... use the same routine as Invoked or not Invoked, ... checks InvokeRequired and, if it's true, Invokes "itself", so the ... But I don't see the advantage of keeping all the code in a single routine. ... Everyone can still call an invoking rotine, and the invoking routine can use a separate delegate method to do the actual work. ...
    (microsoft.public.dotnet.languages.csharp)
  • class object disposal
    ... Simple one - If I have a class that invokes a series of other objects, ... calling their own objects and so on, do I have to explicity dispose of all ... I'm aware of the resource implications of keeping a lot of objects open, ... bit of faffing about. ...
    (microsoft.public.dotnet.framework.compactframework)