2010/4/1 Evgeny Astigeevich <[email protected]>
> Hi,
>
> I'm trying to figure out the code of v8::Handle:
>
> template <class S> bool operator==(Handle<S> that) const {
> internal::Object** a =
> reinterpret_cast<internal::Object**>(**this);
> internal::Object** b =
> reinterpret_cast<internal::Object**>(*that);
> if (a == 0) return b == 0;
> if (b == 0) return false;
> return *a == *b;
>
Note how this doesn't say "return a == b"
> }
>
> The overloaded operator '==' returns true when handles contain the
> same value.
>
> Why is it written in such a way? Is it a workaround of compiler bugs?
> Does not the following code work:
>
> template <class S> bool operator==(Handle<S> that) const {
> return reinterpret_cast<internal::Object*>(**this) ==
> reinterpret_cast<internal::Object*>(*that);
> }
>
> Best regards,
> Evgeny Astigeevich.
>
> --
> v8-dev mailing list
> [email protected]
> http://groups.google.com/group/v8-dev
>
> To unsubscribe, reply using "remove me" as the subject.
>
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev