UInt32 ulSize = 20000L;
MemPtr pMem = MemGluePtrNew (ulSize*2L);

If you use MemPtrNew(), even if you get the parameter problem correct, you still can only allocate a block of memory a little smaller than 64KB.

MemGluePtrNew() will allow a much larger memory block on modern Palm OS devices.

Roger Stringer

At 03:15 AM 1/26/2007, you wrote:
Subject: Re: A funnt bug.
From: "Michael Smith" <[EMAIL PROTECTED]>
Date: Thu, 25 Jan 2007 23:39:22 -0800

I'll take a stab:
If the compiler treats the 20,000 constant as an Int16, when you mutiply by
2 you go over the 2^15 = 32768 limit, which would roll you back around to
some negative number. But, if the number is bigger than an Int16 can handle,
maybe the compiler treats it as an Int32 or a UInt16 ...

Try casting the 20,000 to a UInt16 or UInt32

MemPtrNew( (UInt32)20,000) * 2);

On 1/25/07, Lionscribe <[EMAIL PROTECTED]> wrote:
>
> Can anyone explain me why the code
> MemPtrNew(40000); works fine,
> while the code
> MemPtrNew(20000*2); fails.


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

Reply via email to