[chromium-dev] Re: reminder: don't use CHECK()

2009-07-07 Thread Darin Fisher
I finally got around to revising the text for this section of the coding style doc to bring it inline with what I believe to be our prevailing usage. Please let me know if you have any objections. -Darin On Wed, May 27, 2009 at 11:42 AM, Darin Fisher da...@chromium.org wrote: Thanks for

[chromium-dev] Re: reminder: don't use CHECK()

2009-05-29 Thread Evan Martin
On Thu, May 28, 2009 at 6:55 PM, Evan Stade est...@chromium.org wrote: I was hitting a CHECK() today in x11_util::GetSecondaryXConnection() (or w.e it's called). But that's because X somehow ran out of available connections, or something, and I couldn't launch any other programs either. At

[chromium-dev] Re: reminder: don't use CHECK()

2009-05-29 Thread Evan Stade
I wonder if we were at fault for that? I've never seen that happen otherwise. I only had like 15 X clients according to xlsclients (max is 255). I saved the stack trace but it's worthless as it's just a standard GetScreenInfo ViewHost msg that we attempt to execute with the 2ndary x

[chromium-dev] Re: reminder: don't use CHECK()

2009-05-28 Thread Evan Stade
I was hitting a CHECK() today in x11_util::GetSecondaryXConnection() (or w.e it's called). But that's because X somehow ran out of available connections, or something, and I couldn't launch any other programs either. At that point there's probably nothing to do, but a nice error message might

[chromium-dev] Re: reminder: don't use CHECK()

2009-05-27 Thread Evan Martin
I attempted to add to http://sites.google.com/a/chromium.org/dev/developers/coding-style but !...@#@!...@#! sites in its typically infuriating way made it so I couldn't add text after the last bit I added -- clicking the unindent button would move my cursor a paragraph up -- so I will leave it at

[chromium-dev] Re: reminder: don't use CHECK()

2009-05-27 Thread Darin Fisher
Thanks for trying I want to amend what you wrote since it doesn't really capture the common usage of CHECK to help track down crashers, etc. Also, the statement that we should always recover from a failed DCHECK seems very wrong to me. I don't think it is a good idea to try to recover from

[chromium-dev] Re: reminder: don't use CHECK()

2009-05-27 Thread Peter Kasting
On Wed, May 27, 2009 at 11:42 AM, Darin Fisher da...@chromium.org wrote: Also, the statement that we should always recover from a failed DCHECK seems very wrong to me. I agree, we should almost never recover from a DCHECK. 90+% of the time, DCHECK is better than if (condition) {

[chromium-dev] Re: reminder: don't use CHECK()

2009-05-27 Thread Amanda Walker
On Tue, May 26, 2009 at 11:31 PM, Brett Wilson bre...@chromium.org wrote: Don't bother doing an assertion when the next line will crash anyway: DCHECK(foo); foo-DoSomething(); will normally crash pretty obviously dereferencing a NULL pointer (even though it will be inside DoSomething).

[chromium-dev] Re: reminder: don't use CHECK()

2009-05-27 Thread Greg Spencer
On Wed, May 27, 2009 at 11:56 AM, Amanda Walker ama...@chromium.org wrote: I'd be much happier if DCHECK exited immediately rather than relying on the code to crash, or we insisted that code using DCHECK *always* attempt to recover. Yeah, it seems that relying on the code to crash by itself

[chromium-dev] Re: reminder: don't use CHECK()

2009-05-27 Thread Darin Fisher
It is a nice idea to try to recover from all DCHECKs, but what happens is that you end up with excessive and redundant checking at runtime. It leads to bloat, complexity, and degrades readability (obscuring the code). Those are not good things for a codebase. To be clear, I think we should

[chromium-dev] Re: reminder: don't use CHECK()

2009-05-27 Thread Brett Wilson
On Wed, May 27, 2009 at 11:56 AM, Amanda Walker ama...@chromium.org wrote: On Tue, May 26, 2009 at 11:31 PM, Brett Wilson bre...@chromium.org wrote: Don't bother doing an assertion when the next line will crash anyway:  DCHECK(foo);  foo-DoSomething(); will normally crash pretty obviously

[chromium-dev] Re: reminder: don't use CHECK()

2009-05-27 Thread Amanda Walker
On Wed, May 27, 2009 at 3:20 PM, Darin Fisher da...@chromium.org wrote: I think if we require everyone to handle every failed DCHECK, then what we will really do is compel people to write fewer DCHECKs, which means that we will lose some of the documentation benefits. That seems undesirable

[chromium-dev] Re: reminder: don't use CHECK()

2009-05-26 Thread Peter Kasting
On Tue, May 26, 2009 at 8:31 PM, Brett Wilson bre...@chromium.org wrote: Don't bother doing an assertion when the next line will crash anyway: DCHECK(foo); foo-DoSomething(); I mostly do what Brett does, but I do sometimes DCHECK in cases like this, where the DCHECK is placed at the very

[chromium-dev] Re: reminder: don't use CHECK()

2009-05-26 Thread Antoine Labour
On Tue, May 26, 2009 at 8:31 PM, Brett Wilson bre...@chromium.org wrote: On Tue, May 26, 2009 at 6:22 PM, Aaron Boodman a...@chromium.org wrote: I get different stories about this all the time from different people. It would be great to have them as part of the style guide so that I can

[chromium-dev] Re: reminder: don't use CHECK()

2009-05-26 Thread Darin Fisher
On Tue, May 26, 2009 at 9:13 PM, Peter Kasting pkast...@chromium.orgwrote: On Tue, May 26, 2009 at 8:31 PM, Brett Wilson bre...@chromium.org wrote: Don't bother doing an assertion when the next line will crash anyway: DCHECK(foo); foo-DoSomething(); I mostly do what Brett does, but I do