2014-03-28 17:14 GMT-04:00 Benoit Jacob <jacob.benoi...@gmail.com>: > > 2014-03-28 16:48 GMT-04:00 L. David Baron <dba...@dbaron.org>: > > On Friday 2014-03-28 13:41 -0700, Jeff Gilbert wrote: >> > My vote is for MOZ_ASSERT_UNREACHABLE and MOZ_OPTIMIZE_FOR_UNREACHABLE. >> > >> > It's really handy to have something like MOZ_ASSERT_UNREACHABLE, >> instead of having a bunch of MOZ_ASSERT(false, "Unreachable.") lines. >> > >> > Consider MOZ_ASSERT_UNREACHABLE being the same as >> MOZ_OPTIMIZE_FOR_UNREACHABLE in non-DEBUG builds. >> >> I agree on the first (adding a MOZ_ASSERT_UNREACHABLE), but I don't >> think MOZ_OPTIMIZE_FOR_UNREACHABLE sounds dangerous enough -- the >> name should make it clear that it's dangerous for the code to be >> reachable (i.e., the compiler can produce undefined behavior). >> MOZ_DANGEROUSLY_ASSUME_UNREACHABLE is one idea I've thought of for >> that, though it's a bit of a mouthful. >> > > I too agree on MOZ_ASSERT_UNREACHABLE, and on the need to make the new > name of MOZ_ASSUME_UNREACHABLE sound really scary. > > I don't mind if the new name of MOZ_ASSUME_UNREACHABLE is really long, as > it should rarely be used. If SpiderMonkey gurus find that they need it > often, they can always alias it in some local header. > > I think that _ASSUME_ is too hard to understand, probably because this > doesn't explicitly say what would happen if the assumption were violated. > One has to understand that this is introducing a *compiler* assumption to > understand that violating it would be Undefined Behavior. > > How about.... MOZ_ALLOW_COMPILER_TO_GO_CRAZY ;-) This is technically > correct, and explicit! >
By the way, here is an anecdote. In some very old versions of GCC, when the compiler identified Undefined Behavior, it emitted system commands to try launching some video games that might be present on the system (see: http://feross.org/gcc-ownage/ ). That actually helped more to raise awareness of what Undefined Behavior means, than any serious explanation... So... maybe MOZ_MAYBE_PLAY_STARCRAFT? Benoit > > Benoit > > > >> >> -David >> >> -- >> 𝄞 L. David Baron http://dbaron.org/ 𝄂 >> 𝄢 Mozilla https://www.mozilla.org/ 𝄂 >> Before I built a wall I'd ask to know >> What I was walling in or walling out, >> And to whom I was like to give offense. >> - Robert Frost, Mending Wall (1914) >> > > _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform