> Ummm ...
>
> Forgive my ignorance...
>
> Your argument seems to indicate that
> StrPrintF(display_string, "%s:%c:%s", "str1", 'R', "str");
> should work.
>
> Whether sizeof('R') is 1 or 2 should be irrelevant ; it should get
> promoted to an int because of the varargs promotion rules.
>
> It also seems that you and Roger are saying the same thing; namely, that
> 'R' is an int, not a char.
>
> What am I missing here?  Would a ((char)'R') not get promoted to an int
> anyway?  How is Roger wrong?

No, John is not saying that the given line should work.  He's saying that 'R' is
of type long in m68k-palmos-gcc.  That's four bytes long.  m68k-palmos-gcc does
this in order to support multichar constants like 'code'.  StrPrintF is
expecting an int, which is two bytes long.  Because of the mismatch, StrPrintF
fails.

Here, in table form, is the summary of what John said:

         m68k-palmos-gcc  CW C  CW C++  ISO C  ISO C++
         ---------------  ----  ------  -----  -------
'a'      long             int   char    int    char
'ab'     long             int   int     int    int
'abcd'   long             long  long    int    int

-- Keith



-- 
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