http://d.puremagic.com/issues/show_bug.cgi?id=4906

           Summary: Dereferencing null error in a single expression
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2010-09-21 04:44:16 PDT ---
To find null dereferencing in code the compiler probably needs to perform flow
analysis.
But the compiler can spot and flag as errors at compile-time expressions that
follow explicit comparisons to null:


if (obj is null && obj.foo()) { ...


Where the programmer probably meant to write:
if (obj !is null && obj.foo()) { ...
Or:
if (obj is null || obj.foo()) { ...


This test doesn't cover several cases of dereference null errors that span
different lines of code, but the cases it covers seem common enough to me.

See also bug 4595
See also bug 4571


See also:

http://code.google.com/intl/en-EN/webtoolkit/tools/codepro/doc/features/audit/audit_rules_com.instantiations.assist.eclipse.auditGroup.semanticErrors.html#com.instantiations.assist.eclipse.analysis.audit.rule.dereferencingNullPointer

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to