Sorry, Keith, but is the first (and hopefully the last) time I have to disagree with you.
-----Original Message----- From: Keith Rollin [mailto:[EMAIL PROTECTED]] Sent: Monday, 7 January 2002 2:07 PM To: Palm Developer Forum Subject: RE: Palm and ARM (Was: PL/I for Palm ?) > WinDrawChars (&creatorID, 4, x, y); > is going to break. It depends on how the creator ID is stored. I don't know what will be the PalmOS choice, but I guess I am not the only one to use this type of coding. Taking this into account, it will be muchg safer to agree to keep creator and type in relation to endiannes. In this case taking 'myCR' as creator ID, 'm' goes to LSB for ARM and to MSB for m68k. This is how the compiler should treat 'myCR' as well. Currently I can't see any problem with that approach, can you ? > However, if the resource data is kept in Big Endian > format, then: > if (creatorID == 'myCR') {...} > is going to break. There's no way to keep both intact. Yet, another apology. This should work no matter how the creator ID is represented, otherwise notation like 'myCR' is useless. > char buffer[5]; > > buffer[0] = (char) (creatorID >> 24); > buffer[1] = (char) (creatorID >> 16); > buffer[2] = (char) (creatorID >> 8); > buffer[4] = (char) (creatorID >> 0); > buffer[5] = (char) (0); In case of WinDrawChar we can probaly have buffer[4] without the last assignment: explicit length in WinDrawChars is annoying, and it is a relief when it happens to be usefull :-) A shorter code relies on htons or its analogue, but still an extra field is required: { UInt32 CreatorID_BE = htons(CreatorID); WinDrawChars(&CreatorID_BE, 4, x, y); } Still looks rather awkward to me (well ... a function ... I know). I believe that interpreting an UInt32 as 4-char string is prompted by a big-endian CPU (AFAIK MacOS has an analogue to that, while I386-based systems don't !), and will hopefully remain adequate even with a "non-native" ARM. Michael -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
