Re: Final Procedure



Gary Scott <garylscott@xxxxxxxxxxxxx> wrote:

Gary Scott schrieb:

Why must a final procedure be a subroutine (not a function)?

It kind of violates some coding standards where the return code/value
is always required as an "error code" (success/failure). I think you
might still want to know success/failure as a general standard practice.
I can imagine it returning such to the operating system.

Well, since you don't invoke final procedures, you couldn't get the
result from them anyway. Nor is there any obvious place for the systen
to get it; it isn't as though there is a single final procedure that
gives a single result that could be the program return value. There are,
in general, countless final procedures executed during a program. I
suppose one could specify that whenever any of them returned anything
other than 0 (or whatever other value you wanted to indicate sucess),
the standard could specify that the program would imediately
terminate... or something... but...

Generally speaking, you are describing a C coding style anyway. The
Fortran standard at the least discourages using function return values
as error codes. There are infinite debates (which I won't participate in
if this restarts one) about exactly what cases it is legal in, but by
making even some cases illegal, the standard can be said to at least
discourage the practice. It would be highly inconsistent for the
standard to then go and specify the practice for final procedures; sure
the standard is inconsistent about some things, but don't hold your
breath waiting for this particular inconsistency to happen.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
.



Relevant Pages

  • Re: Brian Kernighan, maybe Im not worthy, maybe Im scum
    ... unimplemented or little-implemented standard. ... the person correcting him for bring it to his attention, ... Because C as a language is defined IN PRACTICE, ... as authority goes, authority on unmoderated newsgroups is a fanciful ...
    (comp.programming)
  • Re: RfD: c-addr/len
    ... Then I wonder why you are asking us to get rid of CHARS ... encodings and MIME, when common practice is using MIME. ... Thus what we see for now, you design standard, you make another series ...
    (comp.lang.forth)
  • Re: String Constants
    ... than for defending bad practice. ... I have not suggested any mandate. ... deliberately fail for those cases. ... I would never deliberately break the standard for no positive benefit ...
    (comp.lang.forth)
  • Re: CfV: Xchar wordset
    ... you push your home-grown libraries as ... volunteer a standard proposal of their own. ... You have no practice using it. ... You assume that CHAR can now interpret input ...
    (comp.lang.forth)
  • Re: Does Fortran support function and subroutine overloading (based on parameter signatures)?
    ... side of that being good practice in my opinion. ... But for the module procedure statement, the standard doesn't allow ... I pointedly do *NOT* like cherry-picking features ... standard specified (as compilers tend to support multiple versions). ...
    (comp.lang.fortran)