Message301335
| Author |
vstinner |
| Recipients |
barry, pitrou, rhettinger, serhiy.storchaka, skrah, vstinner |
| Date |
2017年09月05日.17:10:24 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1504631424.49.0.661108674272.issue31338@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> As suggested in http://bugs.python.org/issue31337#msg301229 it would be better to use
> abort() /* NOT REACHED */
Please don't use abort(), but add a new Py_UNREACHABLE() macro to allow to use a different code depending on the compiler/platform and compiler option (like release vs debug build).
> Can we use compiler-specific code like GCC's __builtin_unreachable()? This would help the optimizer.
That's a good example of better implementation for Py_UNREACHABLE().
The tricky part is to make compiler warnings quiet. For example, you cannot replace "abort(); return NULL;" with "abort()", because a function without return would emit a warning.
Maybe the default implementation of the macro should be:
#define Py_UNREACHABLE(stmt) abort(); stmt
I don't know if it would work. |
|