[webkit-dev] NeverNull<T>

Adam Barth abarth at webkit.org
Tue Jul 28 15:49:49 PDT 2009


I think Oliver was talking about something similar on IRC the other day.

Adam


On Tue, Jul 28, 2009 at 3:25 PM, Eric Seidel<eric at webkit.org> wrote:
> It just occurred to me that we have a lot of places in WebKit were we
> ASSERT(foo) (where foo is some passed in Foo* pointer which should never be
> NULL).
> Maybe it would be cleaner/better/whatever if we instead used a template to
> do this ASSERTing in a centralized place.  The primary advantage would be
> that the ASSERTion is clear in the method signature.
> void doSomething(Foo* foo)
> {
>     ASSERT(foo);
> }
> becomes:
> void doSomething(NeverNull<Foo> foo)
> {
> }
> Could get nasty when interacting with other templates though.  I don't think
> we want a NeverNullOwnPtr, or maybe we do?
> Does this seem useful to anyone else?  Oh c++ experts, does this even seem
> possible, seem like it would perform well, not bloat the code size, etc?
> -eric
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
>


More information about the webkit-dev mailing list