(rafaelw, this isn't personal. It's just the most recent example.)
src/chrome/browser/extensions/extension_tabs_module.cc contains this code at
line 229:

229  int new_index;
230  DCHECK(args->GetInteger(L"index", &new_index));
231  if (new_index < 0) {
232    DCHECK(false);
233    return false;
234  }

This code is a problem in an official release build (and probably some other
release configurations). Luckily, the warning about uninitialized variable
use causes the compile to fail. Official release builds do not have DCHECK
enabled, so line 230 does not exist.

In a release build without DCHECKs enabled, the condition is going to get
optimized away (base/logging.h:409):

// Set to true in InitLogging when we want to enable the dchecks in release.
extern bool g_enable_dcheck;
#define DCHECK(condition) \
    !logging::g_enable_dcheck ? void (0) : \
        LOG_IF(ERROR_REPORT, !(condition)) << "Check failed: " #condition ".
"



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.


Thanks,
Mark

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

Reply via email to