Path: ...!weretis.net!feeder8.news.weretis.net!newsfeed.bofh.team!paganini.bofh.team!not-for-mail From: R Daneel Olivaw Newsgroups: comp.lang.fortran Subject: Re: DEALLOCATE Of Non-ALLOCATEd Should Be No-Op Date: Thu, 17 Oct 2024 10:12:03 +0200 Organization: To protect and to server Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 17 Oct 2024 08:12:03 -0000 (UTC) Injection-Info: paganini.bofh.team; logging-data="1374361"; posting-host="XBJBjenliTep7OIZ0g9xdw.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team"; posting-account="9dIQLXBM7WM9KzA+yjdR4A"; User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 SeaMonkey/2.53.18.2 X-Notice: Filtered by postfilter v. 0.9.3 Bytes: 1874 Lines: 21 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?