Fredrik Jagenheim wrote:
> Have I misunderstood something, or stumbled over a bug?
>
> StrPrintF(charP, "%u %u", 4, -4);
> gives:
> charP = 0x1a614 "4 65532"
>
> Which is correct, as I understand things; But:
>
> StrPrintF(charP, "%lu %lu", 4, -4);
> Ought to return the same thing:
> charP = 0x1a614 "327676 3855"
>
When you call it that way:
00 04 FF FC gets pushed on the stack (after the char pointers)
StrPrintF thinks there's 8 bytes on the stack, interpreting the first 4 as an unsigned
long
(0x0004FFFC == 327676). The other number (3855) is the result of whatever happens
to be on the stack at the time.
use StrPrintF(charP, "%lu %lu", (Int32) 4, (Int32) -4); instead. NOW when you call it
00 00 00 04 FF FF FF FC should get pushed onto the stack and all should go as you
expect it to.
When you give the "l" in the format string, StrPrintF really does expect to find four
bytes on the stack, not two.
I believe if you check the compiler settings you can choose 2 byte or 4 byte ints. I
grew up in Unix land, so
I tend to prefer 4 byte ints. I run into that sort of thing less frequently then.
Your mileage may vary.
--
Adam Wozniak Senior Software Design Engineer
Surveyor Corporation
[EMAIL PROTECTED] 4548 Broad Street
[EMAIL PROTECTED] San Luis Obispo, CA 93401
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/