realbasic-nug
[Top] [All Lists]

Re: pointer arithmetic

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: pointer arithmetic
From: Kevin Ballard <kevin at sb dot org>
Date: Tue, 30 Jul 2002 15:19:48 -0400
On 7/30/02 10:08 AM, "Joseph J. Strout" <joe at realsoftware dot com> wrote:

> At 1:05 AM +0200 7/30/02, Matthias Buercher wrote:
> 
>>   packed.size = p.ptr(0)-packed.ptr(0)
>> // apparently this does not work
> 
> Instead try:
> 
>  packed.size = p.long(0) - packed.long(0)
> 
> Hmm... though on second thought, that's the equivalent of what you
> wrote, but it's still not right.  Each of the first two parameters to
> PackBits is a pointer to a pointer -- not just a pointer to some
> data, as you're giving it.  So you need to get a little fancier in
> your code, and set up a memoryBlock that points to a MemoryBlock for
> both source and dest.  Then something like the above will get you the
> size you need.

How is that the equivalent? packed.ptr(0) should return a memoryblock,
whereas packed.long(0) returns an integer. So the first way shouldn't even
compile.

-- 
Kevin Ballard
kevin at sb dot org
Email from Korea or China must go to <kevin dot nb at sb dot org>
http://kevin.sb.org/



<Prev in Thread] Current Thread [Next in Thread>