Professional Web Applications Themes

FOUR_CHAR_CODE constants? - Mac Programming

This should be trivial, but I can't create a UInt32 constant using four char codes in Project Builder. The following all give me an error: const UInt32 i = 'test'; const UInt32 i = FOUR_CHAR_CODE('test');...

  1. #1

    Default FOUR_CHAR_CODE constants?

    This should be trivial, but I can't create a UInt32 constant using four
    char codes in Project Builder. The following all give me an error:

    const UInt32 i = 'test';
    const UInt32 i = FOUR_CHAR_CODE('test');
    Richard Guest

  2. #2

    Default Re: FOUR_CHAR_CODE constants?

    In article <168.202.221>,
    net.invalid (Richard Hough) wrote:
     

    Check your gcc flags in Project Builder's building styles panel. You
    probably have gcc set to reject 4-character character-constants.
    David Guest

  3. #3

    Default Re: FOUR_CHAR_CODE constants?

    In article <sf.sbcglobal.net>,
    David Phillip Oster <org> wrote:
     
    >
    > Check your gcc flags in Project Builder's building styles panel. You
    > probably have gcc set to reject 4-character character-constants.[/ref]

    David's right. I'll add, though, that using "FOUR_CHAR_CODE" is
    pointless. From Panther's ConditionalMacros.h:
    -----
    FOUR_CHAR_CODE
    This conditional is deprecated. It was used to work around a bug in one
    obscure compiler that did not pack multiple characters in single quotes
    rationally.
    It was never intended for endian swapping.
    -----

    So yes,
    const UInt32 i = 'test';
    is the right way to write it. :)

    -Eric

    --
    Eric Albert edu
    http://rescomp.stanford.edu/~ejalbert/
    Eric Guest

  4. #4

    Default Re: FOUR_CHAR_CODE constants?

    > Check your gcc flags in Project Builder's building styles panel. You 

    Thanks, but it don't know what I have to change to enable 4-char
    constants. The only settings I have in the Build Styles panel are:

    COPY_PHASE_STRIP = NO
    OPTIMIZATION_CFLAGS = -O0

    Do I need to add a new one?

    I looked in CarbonHeaders.h and saw it was full of definitions like:

    enum {
    kEventClassMouse = 'mous'
    };

    Must I make the constants enums? I want to define the type.
    Richard Guest

  5. #5

    Default Re: FOUR_CHAR_CODE constants?

    In article <168.202.221>,
    net.invalid (Richard Hough) wrote:
     
    >
    > Thanks, but it don't know what I have to change to enable 4-char
    > constants. The only settings I have in the Build Styles panel are:[/ref]

    Here is a screen shot of where the warning is located.

    I selected the project itself in XCode's Groups&Files pane and brought
    up the info window:

    <http://www.turbozen.com/mac/4charcode/>

    -- David Phillip Oster
    David Guest

Similar Threads

  1. ADO Constants
    By CJM in forum ASP Database
    Replies: 13
    Last Post: February 12th, 02:24 PM
  2. constants
    By Michael MüLler in forum PHP Development
    Replies: 3
    Last Post: November 22nd, 12:06 PM
  3. ASP Constants
    By Jack in forum ASP Database
    Replies: 3
    Last Post: October 21st, 01:20 AM
  4. Using Constants
    By Shawn McKenzie in forum PHP Development
    Replies: 0
    Last Post: August 11th, 07:42 PM
  5. VBS Constants
    By Guinness Mann in forum ASP
    Replies: 3
    Last Post: August 6th, 06:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139