[cfe-commits] r43023 - in /cfe/trunk: Sema/SemaDecl.cpp Sema/SemaExpr.cpp clang.xcodeproj/project.pbxproj

Chris Lattner clattner at apple.com
Thu Oct 18 15:00:02 PDT 2007


On Oct 18, 2007, at 11:17 AM, Steve Naroff wrote:

>
> On Oct 18, 2007, at 10:04 AM, Chris Lattner wrote:
>>
>>> If I don't use dyn_cast_or_null(), the following case will bus  
>>> error. With dyn_cast_or_null(), we assert (missing '@interface  
>>> NSConstantString').
>>
>> I don't see how this is any better: you're trading one crash for  
>> another.
>
> If that's true, then why use asserts at all? From my perspective,  
> we use them because they are helpful during development. Since  
> clang is under active development, I think there is a big  
> difference between an assert crash and a bus error. For me, an  
> assert often has an implied "FIXME"...

Steve and I discussed this in person.  The answer is that there is a  
difference between:

    assert(x && "x should always be true");

and:

   assert(x && "FIXME: need to handle when x is null");


I agree that an assert with a FIXME in it is a much better experience  
than clang just crashing. :)

-Chris






More information about the cfe-commits mailing list