On 29-Sep-07, at 2:37 PM, Daniel Stenning wrote:
> Talking of which, one bit of tedium I find myself having to do a
> lot of
> these days is assigning a memoryblock reference to a Ptr variable,
> in order
> that I can do high performance processing on memoryblocks. It makes
> a hell
> of a difference to use the Ptr dereferencing syntax instead of the
> memoryblock methods. I really wish there were a built in property
> that just
> always gave us the pointer to the memoryblock. I have wrapper
> "buffer"
> class that does just this, but I still wish it were automatically
> built in.
Any built-in Ptr property would have to be read-only and computed on
every access since the address can and will change if the block is
resized. For the sake of speed it's probably best to live with a
subclass that exposes an "Address As Ptr" property that's assigned in
overloaded Constructor and Size methods. Then just be careful to
always access that directly, and never write to or cache it elsewhere.
Frank.
<http://developer.chaoticbox.com/>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|