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

Home » Public Forums » archive » Re: Conflicting data structures.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Conflicting data structures. [message #38234] Fri, 27 February 2004 08:31
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Nuno Oliveira writes:

> I have I problem, and perhaps you can help...
>
> I have pointer of structures. I defined in the main program as Data =
> ptr_new(/allocate_heap)
>
> And the when the user starts to generate events I have a structure like
> this. I made it an isolated function just to avoid problems with
> defining structures, but it still does. How is this possible?
>
> PRO Add_NewStrct, s
> new_strct = {tag1: name, tag2: array, tag3: ptr_new(/allocate_heap)}
> new_strct.tag3 = Result_of_a_function()
> ;if it matters is the result is a pointer do pointers
>
> if n_elements(*s.Data) eq 0 $
> then *s.Data = new_strct $
> else *s.Data = [*s.Data, new_strct]
>
> return, s
> end
>
> The error idl indicates is: data conflicting strucutures <ptrHep xyz>
> new_strct
>
> I tought once the function is finished he would loose previuos
> information about the strcuture? But it seems that's not it.
> I was looking in old questions here, and I tried to use ptr_free for
> that tag3, but I had the same problem again...

The answer is that anonymous structures have "secret" names, which
keeps them from being concatenated in this way. Here is an article
to read:

http://www.dfanning.com/tips/concatenate_structs.html

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Conflicting data structures.
Next Topic: Map contour data in only the USA

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

Current Time: Sat Oct 11 08:52:59 PDT 2025

Total time taken to generate the page: 1.20282 seconds