[Coco] Microware C Compiler port
Bill Barnes
da3m0n_slay3r at yahoo.com
Thu Jan 22 09:20:48 EST 2009
Hmmm, I thought it was this way: printf("long int: %l",longint);
I do know that using "%d" deals with an int though, never seen it referenced as "%ld"
As far as length.... compiler specific. only guarantees is long is not smaller than an int, and int is not shorter than a short. I forget the OS-9 C (CoCo) lengths, and don't feel like chasing down my manual.
-Later! -WB- -- BABIC Computer Consulting.
--- On Wed, 1/21/09, William Astle <lost at l-w.ca> wrote:
> From: William Astle <lost at l-w.ca>
> Subject: Re: [Coco] Microware C Compiler port
> To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
> Date: Wednesday, January 21, 2009, 7:37 PM
> John W. Linville wrote:
> > On Thu, Jan 22, 2009 at 10:47:38AM +1000, Bob Devries
>
> Correct me if I'm wrong, but how does this theory work:
>
> Assumption: long is twice as many bits as int and
> big-endian byte order,
> both of which should be valid here.
>
> Pretend we have a "long" value of 16. That would
> get onto the stack as
> the following string of bytes: 00, 00, 00, 10.
>
> Now printf() is looking for an integer so it only grabs 16
> bits from the
> stack which gets the bytes: 00 00
>
> Magically, our "long" value turns into a 0.
>
> The theory is that the format string being used is only
> cuing printf()
> to look for an int value but a long int is on the stack.
>
> I'm not overly familiar with the microware C compiler
> and the C library
> involved but usually "%ld" is used for long ints
> rather than "%D", is it
> not?
>
> --
> William Astle
More information about the Coco
mailing list