[ale] Copy a Structure - A C Question
Byron A Jeff
byron at cc.gatech.edu
Fri Jun 14 12:56:01 EDT 2002
>
>
>
>
>
> Thanks Fletch. I see your point. In this particular scenario, the newly copied
> structure needs exactly the same attributes as the original so a shallow
> copy is ok. Basically, I just need to separate out a few items from the master
> linked list such that the address of the new list can be passed to another
> function for processing as a "read only" operation. The new linked list is
> only needed for a few milliseconds so I believe a shallow copy in this
>particular application is acceptable.
This is clearer. Please read my other post then. You'll definitely want to
look at creating a view using pointers. There's no reason at all to copy the
actual structs.
>Now I'm concerned about freeing the copy.
Why?
> In my
> lexperiment with this I hadn't actually freed the copy from memory. I will
> check to see if this cause a core dump.
It shouldn't. whatever copy you're using is independent of the original. You
should be able to get rid of it with no problem.
>
> This discussion has made me more aware of the internals of what I am doing
> and I apprecate Byron and Fletch's responses.
No problem. Glad to be of help.
BAJ
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
More information about the Ale
mailing list