What is the type of an enum whose values appear to be strings?

后端 未结 4 1950
广开言路
广开言路 2020-12-31 07:03

I am working with Apple\'s ScriptingBridge framework, and have generated a header file for iTunes that contains several enums like this:

         


        
4条回答
  •  清歌不尽
    2020-12-31 07:41

    As already stated, those are integers declared using character constants.

    When an integer is declared using a character constant of more than one character, it is sensitive to the byte order of the machine for which the constant was developed. As all the original Mac APIs were on PPC or earlier machines, they are backwards with respect to Intel Little-Endian machines.

    If you are only building for Intel you can just reverse the order by hand.

    If you are building a Universal binary you need to use a flipping function such as CFSwapInt32BigToHost.

    Failure to correct those codes will leave you with code that could only work on PowerPC machines, regardless of the lack of compiler errors.

提交回复
热议问题