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

前端 未结 13 2440
轻奢々
轻奢々 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:15

    If you expect your method to fail occasionally, but don't consider that exceptional, I prefer this pattern as used in the .NET Framework:

    bool TryMyFunction(out FunctionResult result){    
    
         //...    
         result = new FunctionResult();
    }
    

提交回复
热议问题