Converting to 64 bits

By: | Post date: October 17, 2009 | Comments: No Comments
Posted in categories: Cocoa

It’s time to spend a little quality time with MagicBrush-Photo and start getting it ready for Snow Leopard. Step one is getting it ready to handle 64-bit addressing.
The Starting point is Apple’s own documentation. It provides as great overview of considerations and reasons to start migrating your code to 64-bit addressing.

Within that document, there is a specific reference on migrating an existing application to support 64-bit.

A key excerpt is :

/Developer/Extras/64BitConversion/ConvertCocoa64 `find . -name ‘*.[hm]’ | xargs`

As the script runs, it does the following things:

  • It converts most instances of int and unsigned int to NSInteger and NSUInteger, respectively. It doesn’t convert ints in bit-field declarations and other inappropriate cases. During processing, the script refers to a hardcoded list of exceptions.
  • Important: The script converts instances of int and unsigned int that are properly the types of arguments and return values in POSIX calls. You must be aware of these instances and manually revert them (or leave them alone, if that is more appropriate).

  • It converts most instances of float to CGFloat, again leaving untouched those exceptions specified in a hardcoded list.
  • It does not convert enum declarations to types with guaranteed fixed sizes (as described in “Enumeration Constants”). You need to fix these declarations by hand.
  • It flags (with inline warnings) cases that need to be fixed manually. See “Things to Look For During Conversion” for details.

Next – Updating to 10.6 SDK