[chromium-dev] Re: Don't do work in a DCHECK

2009-04-23 Thread Peter Kasting
On Wed, Apr 22, 2009 at 8:39 PM, Mark Larson (Google) m...@chromium.orgwrote:

 So, please don't do any work in a DCHECK. We're lucky that the above
 example failed to compile, but it's possible to write code like this that
 would compile and just cause bizarre errors in release builds.


...and I have written such code (~1.5 years ago).  It was annoying to track
down.  Don't be dumb like me.  Don't do anything with side effects inside
CHECK(), DCHECK(), or similar.

PK

--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---



[chromium-dev] Re: Don't do work in a DCHECK

2009-04-23 Thread Evan Martin

On Thu, Apr 23, 2009 at 6:53 AM, Peter Kasting pkast...@chromium.org wrote:
 ...and I have written such code (~1.5 years ago).  It was annoying to track
 down.  Don't be dumb like me.  Don't do anything with side effects inside
 CHECK(), DCHECK(), or similar.

FWIW, in non-Chromium Google code it is very common to do
CHECK(DoImportantWork()), which is why for me it was a hard habit to
lose.  I was still writing these sorts of bugs occasionally a year
after starting on this project.

--~--~-~--~~~---~--~~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
http://groups.google.com/group/chromium-dev
-~--~~~~--~~--~--~---