Is there a compiler setting that can warn about these? Currently I'm reviewing code and putting in #warning don't use error:nil
whenever I see them.
是否有可以警告这些的编译器设置?目前我正在审查代码并输入#warning不会在我看到它们时使用错误:nil。
(I know it's sometimes appropriate to do, but maybe there is a better way to have the compiler check sloppy error handling?)
(我知道有时这样做是合适的,但也许有更好的方法让编译器检查草率错误处理?)
1
No, since error:nil is completely legal and totally legit (as you even say), there is no way for the compiler to check it.
不,因为错误:nil完全合法且完全合法(正如你所说),编译器无法检查它。