Your search query "linkto%3A%22MacPython%2FFourCharacterCode%22" didn't return any results. Please change some terms and refer to HelpOnSearching for more information.
(!) Consider performing a full-text search with your search terms.

Clear message

By convention, Apple uses four character codes in place of integer enumerations in almost all of its software, protocols, and file formats.

Notes:

Examples:

In Python, four character codes are passed around as four character str (primarily for introspection purposes). Some Python code will automatically interchange four character codes with str, unicode, int, or long but that will not be the general case until Python 2.4 at the earliest. ../bgen may output constants that look like FOUR_CHAR_CODE('shor'), however FOUR_CHAR_CODE is (currently) a no-op and just returns the input string unchanged.

In C, four character codes are interchangable with 32 bit integer types and will usually be defined in an enumerator:

/*  
    This is how you will see them in Universal Interfaces format 
*/
enum {
    MyConstant = FOUR_CHAR_CODE('MooV'),
    MyOtherConstant = FOUR_CHAR_CODE('©xxx')
}

/*  
    This is the "new way" that you will see in OS X frameworks
*/
enum {
    MyConstant = 'MooV',
    MyOtherConstant = (long)0xA9787878 /* so that the source isn't tainted with high ascii */
}

See also:

Unable to edit the page? See the FrontPage for instructions.