Is there a name for this anti-pattern/code smell?

前端 未结 13 2454
轻奢々
轻奢々 2021-02-12 16:00

Let me start by saying that I do not advocate this approach, but I saw it recently and I was wondering if there was a name for it I could use to point the guilty party to. So h

13条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-12 16:34

    If you don't want to use exceptions, the cleanest way to do it is to have the function return the error/success code and take either a reference or pointer argument that gets filled in with the result.

    I would not call it an anti-pattern. It's a very well proven workable method that's often preferable to using exceptions.

提交回复
热议问题