On 2005-06-17 05:21:09 +0100 Nicola Pero <[EMAIL PROTECTED]> wrote:


In
http://gnustep.org/resources/documentation/Developer/Base/ProgrammingManual/manual_4.html#SEC51
it says, for +new, to use...

+ new
{
   Point *point = [[self alloc] init];
     // note "self" refers to the "Point" _class_ object!
   return AUTORELEASE(point);
}

... but NSObject.m says...

+ (id) new
{
   return [[self alloc] init];
}

... which one is right?

NSObject.m is right. +new is supposed to be exactly the same as +alloc followed by -init ... probably a typo in the Base programming manual :-)

I've fixed the programming manual ... worse than just a typo ... wrong on memory management in a few places, with the appearance that the author was wrong/confused in understanding what +new methods do. I don't know how we missed it during proofreading. It could probably do with other people checking it too, as it's obviuously easy to miss these things.



_______________________________________________
Bug-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to