"Keith Rollin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >>  Is it possible to use DmWrite() on ordinary memory?  I have cases
where

> >Try it and see.  My suspicion is that is will probably fail, as DmWrite
is

> Ugh, I can't believe that advice just crossed this forum!  Using that
> logic, if I rob a house and don't get caught, it must be OK.  :-)

Err... My point was that if Todd want's an answer to such a simple question,
it's usually not very hard to just go out and get the answer yourself.  I
was not trying to judge the merits of *why* you would want to do it.

> >Why can't you just keep track of the type of memory yourself, then use
the
> >appropriate DmWrite or MemMove calls? Even if DmWrite happens to work, it
is
> >always going to be slower than MemMove...

> Now, *this* is advice I like!  To it, I should add "Even if using
> DmWrite works on non-storage heap memory now, there's nothing that
> says it won't in the future".

Nice to see I'm not completely full of bad ideas.... Mind you, I'm surprised
Aaron hasn't chimed in with advise on replacing all calls with MemMove,
wrapped around a liberal sprinkling of Semaphore tinkering. :-)

Todd, as you can see, you're not heading down the right path.  If you're
going to find it difficult to keep track of the type of pointer you're
dealing with, the legal way of handling your requirement is:

#define SafeUlgyDmWrite(a,b,c,d)
{MemPtrDataStorage(a)?DmWrite(a,b,c,d):MemMove(a+b,c,d);} /*Note - Untested
code... Use at you're own risk!!!*/

You can now use the aptly named "SafeUlgyDmWrite" to replace all your
DmWrites, and not care whether they're into Dynamic or Storage Memory.


Let me know if this helps.

Alan



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to