[webkit-dev] deleteOwnedPtr(T* ptr)

Daebarkee Jung daebarkee at gmail.com
Wed Nov 10 14:33:53 PST 2010


Hi,

I found that the following lines made errors:
// OwnPtrCommon.h
template <typename T> inline void deleteOwnedPtr(T* ptr)
{
        typedef char known[sizeof(T) ? 1 : -1];
        if (sizeof(known))
    delete ptr;
}

I am very curious about why the author wrote like the above.
What could be the author's intention?

For error-fix, I changed it like the following:

template <typename T> inline void deleteOwnedPtr(T* ptr)
{
      if(sizeof(T)>0)
            delete ptr;
}

What could be the above code's mistake?


Thanks,

Daebark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20101110/8ed63b11/attachment.html>


More information about the webkit-dev mailing list