C: Nested Ifs or Gotos

后端 未结 5 2233
温柔的废话
温柔的废话 2021-02-15 03:45

What is the best way to manage resources for a C program. Should I use a nested if structure or should I use goto statements?

I am aware there is a lot

5条回答
  •  离开以前
    2021-02-15 04:10

    Always use one goto in each program to annoy the purists


    That's my philosophy.

    Seriously, on some occasions a goto is reasonable, especially if it just does something obvious like jump to common return code at the bottom of a function.

提交回复
热议问题