Return Statement - Criticism

Criticism

It has been argued that one should eschew the use of the explicit return statement except at the textual end of a subroutine, considering that, when it is used to "return early", it may suffer from the same sort of readability problems that are claimed to exist for the GOTO statement. For instance, that in later development, a return statement could be overlooked by a developer, and an action which should be performed at the end of a subroutine (e.g.: a trace statement) might not be performed in all cases. Conversely, it can be argued that using the return statement is worthwhile when the alternative is more convoluted code, harming readability. Languages without a return statement, such as standard Pascal don't have this readability problem.

Some early implementations of languages such as the original Pascal and C restricted the types that can be returned by a function (e.g. not supporting record or struct types) to simplify their compilers.

Read more about this topic:  Return Statement

Famous quotes containing the word criticism:

    ...I wasn’t at all prepared for the avalanche of criticism that overwhelmed me. You would have thought I had murdered someone, and perhaps I had, but only to give her successor a chance to live. It was a very sad business indeed to be made to feel that my success depended solely, or at least in large part, on a head of hair.
    Mary Pickford (1893–1979)

    I, with other Americans, have perhaps unduly resented the stream of criticism of American life ... more particularly have I resented the sneers at Main Street. For I have known that in the cottages that lay behind the street rested the strength of our national character.
    Herbert Hoover (1874–1964)

    Unless criticism refuses to take itself quite so seriously or at least to permit its readers not to, it will inevitably continue to reflect the finicky canons of the genteel tradition and the depressing pieties of the Culture Religion of Modernism.
    Leslie Fiedler (b. 1917)