gnustep-dev
[Top][All Lists]
Advanced

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

RFC Distributed Object behavior for pointers


From: Richard Frith-Macdonald
Subject: RFC Distributed Object behavior for pointers
Date: Fri, 11 Apr 2003 19:27:28 +0100


DO supports return of pointer values and passing of them as arguments.

eg.

char *methodReturningACString;

would return a nul terminated string of characters and

struct foo *methodReturningStructPointer;

would return a pointer to a struct.


in NeXTstep, the memory holding the returned data was owned by the *caller*, so you had to do -

char *ptr = [obj methodReturningACString];
// Use ptr
if ([obj isProxy]) free(ptr);

I don't know how OPENSTEP does this ...
Does it work like NeXTstep or does it return a pointer to autoreleased memory?

How should GNUstep do it?
Do we want to make the calling code check to see if it is calling a method via DO, and free the memory explicity, or do we want to use autoreleased memory for consistency with the way objects are returned, and have the caller copy the contents of the memory if it wants to keep it?
The second form seems better to me, but I don't know what OPENSTEP does.





reply via email to

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