Recently, I was studying chromium and v8 source code, and saw a lot of CHECK
or DCHECK
. Among them, many DCHECK
are checks on parameter types, or bounds on arrays, and DCHECK
are closed in the release version.
DCHECK(key->IsName() || key->IsNumber()); // Check for types
DCHECK(desc->is_empty()); // Check for borderline conditions
Shouldn't it be better to use CHECK for boundary or type checks, which is still working in the release version? Or when choosing to use DCHECK
or CHECK
, are there any criteria? Because sometimes, the check that should be kept uses DCHECK
it confuses me alot, i don't know whether DCHECK or CHECK should be used