GNUStep Macros

From GNUstepWiki
Jump to navigation Jump to search


GCC

Platform Dependant

  • ifdef __MINGW__ /*do*/ #endif Windows POSIX

Memory Managment

  • RETAIN(x) Bump the retain cound of x where x does not inherit from NSObject. As in foundation objects.
  • RELEASE(x) Decrement the retain count of X
  • AUTORELEASE(x)
  • ASSIGN(object,value) to assign an object variable, performing the appropriate re- tain/release as necessary.
  • ASSIGNCOPY(object,value) to copy the value and assign it to the object.
  • DESTROY(object) to release an object variable and set it to nil.
  • CREATE AUTORELEASE POOL(name) to create an autorelease pool with the spec- ified name.
  • IF NO GC(X) compile the code ’X’ only if GarbageCollection is not in use.
  • #ifdef __OBJC_GC__ /*Code*/ #endif If garbage collection is on then include, otherwise skip.
  • __weak This object is weak, if nothing references it, it will be collected.
    1. ifndef _WIN64 if not 64-bit windows
  • GS_WITH_GC is gnustep && has garbage collection


Misc