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:

    The critic lives at second hand. He writes about. The poem, the novel, or the play must be given to him; criticism exists by the grace of other men’s genius. By virtue of style, criticism can itself become literature. But usually this occurs only when the writer is acting as critic of his own work or as outrider to his own poetics, when the criticism of Coleridge is work in progress or that of T.S. Eliot propaganda.
    George Steiner (b. 1929)

    ...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)

    A friend of mine spoke of books that are dedicated like this: “To my wife, by whose helpful criticism ...” and so on. He said the dedication should really read: “To my wife. If it had not been for her continual criticism and persistent nagging doubt as to my ability, this book would have appeared in Harper’s instead of The Hardware Age.”
    Brenda Ueland (1891–1985)