Re: Deferred events and ugly pointers [was: Win32 & timer]


Subject: Re: Deferred events and ugly pointers [was: Win32 & timer]
From: Mike Nordell (tamlin@algonet.se)
Date: Wed Nov 15 2000 - 12:17:03 CST


Martin Sevior wrote:
> It might be hard to block other Abi operations during these update events.

The needed locking code surely must already exist in (at least) word count
and lists dlg.

> > However, if the only reason to do this is to get unique pointers (that
are
> > never dereferenced I'd hope), what about
> >
> > m_pFakeSdh[i] = reinterpret_cast<PL_StruxDocHandle>(new char);
> >
> > ? :-)
>
> I'll check that out. Will m_pFakeSdh[i] point to an executable area of
> memory with this cast?

Absolutely not! Though many platforms set the execute page protection bit
(where page protection exists) on such pages, it is in no way to count on.

However, this is irrelevant since the existing code using a pointer to an
XAP_App object is not pointing to executable memory/code.

A note about the cast: the reason I used reinterpret_cast is that it's the
suggested way of casting stuff in C++ (to display "this is as typesafe as a
void*", i.e. it's a Bad Thing). A C style cast would in this case be
equivalent to the reinterpret_cast, but it's deprecated. If the types were
related (such as D deriving B) one should use static_cast. dynamic_cast is
forbidden in AW code because of the requirements in the coding guidelines
(#3: RTTI is not allowed).

/Mike



This archive was generated by hypermail 2b25 : Wed Nov 15 2000 - 12:25:49 CST