Being pressured to GOTO the dark-side

前端 未结 10 953
我在风中等你
我在风中等你 2020-12-23 16:21

We have a situation at work where developers working on a legacy (core) system are being pressured into using GOTO statements when adding new features into existing code tha

10条回答
  •  执笔经年
    2020-12-23 16:24

    If a change to the program requires "just one little goto" I would say that the code was very maintainable.

    This is a common problem when dealing with legacy code. Stick to the style the program was originally written in or "modernize" the code. For me the answer is usually to stick with the original style unless you have a really big change that would justify a complete re-write.

    Also be aware that several "modern" language features like java's "throw" statement, or SQLs "ON ERROR" are really "GO TO"s in disguise.

提交回复
热议问题