Richard Hartman <[EMAIL PROTECTED]> wrote:
[quoting various people]
>>> this is leagal in ansi-c, but implementation dependant.

The reason this is implementation dependent has, of course, to do with
endianness issues.

>>#define FourByte(a,b,c,d)  ((UInt32)((a) << 24 + (b) << 16 + (c) << 8 + (d)))
> I am sure that he meant "FourByte('a','p','p','l')"
[...]
> You could also use hex literals, if you are comfortable with them.
> The hex literal for 'appl' would be 0x6170706C.

Both of these are subject to those same endianness issues.  On many hosts,
you'll need to convert creator ids and db types and such to device format
if you represent them numerically like this.

In host code, I prefer to consider these things to be fixed length
strings.  I'd write that one as `"appl"' and manipulate it with strncpy
and printf("%.4s").  This works very nicely IMHO.

> Now CW treats 'appl' correctly ... but what about GCC?  Does
> it reveal it's Intel bias there?

Like everyone else has said, I'm not sure what planet you're on if you
think GCC has an Intel bias.

> Does 'appl' even compile w/ GCC?

It'd be nice if you checked the archives before asking these rhetorical
questions.  See http://www.escribe.com/computing/pcpqa/m18245.html .

    John  "wow, we get to use strncpy() for what it was designed for!"

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to