comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Are pointers faster in structs ?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Are pointers faster in structs ? [message #16900] Wed, 25 August 1999 00:00
Richard Tyc is currently offline  Richard Tyc
Messages: 69
Registered: June 1999
Member
I use a large structure for holding all data in the main widget's user
value.

eg
sState = { btndown: 0b, $
cannEndSel: 0b,$
DataDim: DataDim, $
cube: TEMPORARY(cube) }

cube could be large , say bytarr(512,512,20) Now when the user wants to
load a differnet data set, I guess I have the choice of doing
something like:

sState.cube = 0 ; Free memory to cube ?

newcube = Getnewdata()

sState.cube = TEMPORARY(newcube)

Is this any faster/slower or better/worse than using pointers in the
structure ?
What if I need to initialize the elements of the structure before I have
the size of data ?

I need to define sState first without knowing the size of cube. Could I
do something like :

cubePtr = PTR_NEW(/ALLOCATE_HEAP)
sState = { btndown: 0b, $
cannEndSel: 0b,$
DataDim: DataDim, $
cubePtr: cubePtr }

Then later in code, knowing cube :

cube = bytarr(512,512,20)
sState.cubePtr = PTR_NEW(cube, /NO_COPY)

Is this syntax correct ? Would this be moe efficient then storing cube
directly in sState ?

Thanks in Advance

Rich
  • Attachment: richt.vcf
    (Size: 0.29KB, Downloaded 55 times)
[Message index]
 
Read Message
Previous Topic: Re: Are pointers faster in structs ?
Next Topic: Re: Image slicing

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:09:41 PDT 2025

Total time taken to generate the page: 0.00381 seconds