C: Nested Ifs or Gotos

后端 未结 5 2231
温柔的废话
温柔的废话 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:17

    Personally I have used goto in this manner in the past. People hate it because it reminds them of the spaghetti code they used to write/maintain, or because someone who wrote/maintaned such code beat the concept that gotos are evil into them.

    You probably could write something decent without goto, sure. But it's not going to do any harm in this kind of circumstance.

提交回复
热议问题