Sujet : Re: DEALLOCATE Of Non-ALLOCATEd Should Be No-Op
De : Danny (at) *nospam* hyperspace.vogon.gov (R Daneel Olivaw)
Groupes : comp.lang.fortranDate : 17. Oct 2024, 09:12:03
Autres entêtes
Organisation : To protect and to server
Message-ID : <veqgsj$19u4p$1@paganini.bofh.team>
References : 1 2 3
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 SeaMonkey/2.53.18.2
Lawrence D'Oliveiro wrote:
On Wed, 16 Oct 2024 20:57:17 -0500, Gary Scott wrote:
On 10/16/2024 7:51 PM, Lawrence D'Oliveiro wrote:
>
It’s annoying to find that if you try to DEALLOCATE an ALLOCATABLE
variable that has not been ALLOCATEd (or that has already been
DEALLOCATEd), this is an error.
>
The way these things are handled in Fortran is to add a "stat="
specifier.
But I don’t want to catch errors as a result of invalid, non-NULL pointers
-- let that be trapped as a runtime error as usual. I just want a free of
NULL to be a harmless no-op.
The trouble with “stat=” is like “ON ERROR GOTO” in BASIC of old: you
either catch everything or nothing, you cannot be selective in the
exceptions you catch.
Doesn't the content of STAT tell you what the error was?