GNUStep NSAutoreleasePool incompatibility

According to another stack overflow message, the drain message is an Apple call only:

 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog (@"Hello"); [pool drain]; return 0; 

Is it safe to replace drain with release ? I am trying to connect an Objective-C application to work on Linux (Ubuntu at the moment). Do I have to give up even before I start? (I'm already having problems trying to get NSURLConnection )

+4
source share
1 answer

From the Apple drain documentation:

[...] this method behaves the same as the release. [...]

Thus, the depletion of the pool of auto resources means its unjustified liberation. In my opinion, Apple should abandon drain , as this only creates confusion.

But:

Special considerations:
In a garbage collection environment, release is non-op, so if you do not want to give the collector a hint, it is important to use drain in any code that can be compiled for garbage collection.

+4
source

All Articles