[webkit-reviews] review granted: [Bug 39950] Documentation on various assertion macros : [Attachment 58000] Documentation on assertion macros

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 7 07:23:16 PDT 2010


Darin Adler <darin at apple.com> has granted Jeremy Moskovich
<playmobil at google.com>'s request for review:
Bug 39950: Documentation on various assertion macros
https://bugs.webkit.org/show_bug.cgi?id=39950

Attachment 58000: Documentation on assertion macros
https://bugs.webkit.org/attachment.cgi?id=58000&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
I think there's one significant type of guideline missing here: Assertions
should only be used for conditions that the programmer knows won't occur. We
should never assert, for example, that a file system call has succeeded,
because there is no way for a programmer to guarantee that. Assertions are
claims that a programmer knows to be true, and they fire only when that
programmer turns out to be wrong because there is some kind of programming
mistake. There should be no "wishful thinking" assertions.

The phrase "other bad behavior deserving attention" fuzzes this issue a bit.
There are many types of bad behavior where an assertion is not an acceptable
way to check.

The section that talks about "recover from non-fatal errors" is also now vague
enough that I think it's not as useful as it once was.

I'd prefer that the examples include the best programming style as possible.
I'm not all that fond of the idea of naming a local variable "mem" in the
example.

I think it's OK to land this now, and I think there is room for improvement
too.


More information about the webkit-reviews mailing list