swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Return pointer to array: not possible?


From: Eric Werk
Subject: Re: Return pointer to array: not possible?
Date: Thu, 01 Apr 1999 19:07:08 +0200

Paul E. Johnson wrote:
> 
> id attribute[10];
> How can I return that when another agent wants the attribute vector?

I would think you could just do this:

- (id *) getArray
{
  return attribute;
}

Use:

id *attr;
attr = [otherObject getArray];

This returns a pointer to the array (in C, arrays and pinters are the
same thing - messy, but efficient) But beware: this is exactly the same
thing that the original object has, so changes via the new array will
also change the original array!

/Eric Werk

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]