[Coco] Microware C Compiler port
devries.bob at gmail.com
Thu Jan 22 15:37:00 EST 2009
>From the Microware C Compiler manual:
An optional character "l" indicates that the following "d","x", or "o" is
the specification of a long integer argument
Also, from the manual, CHAR is 1 byte, INT is 2 bytes, UNSIGNED is 2 bytes,
LONG is 4 bytes, FLOAT is 4 bytes and DOUBLE is 8 bytes.
Regards, Bob Devries, Dalby, Queensland, Australia
Isaiah 50:4 The sovereign Lord has given me
the capacity to be his spokesman,
so that I know how to help the weary.
my blog: http://bdevries.invigorated.org/
----- Original Message -----
From: "Bill Barnes" <da3m0n_slay3r at yahoo.com>
To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
Sent: Friday, January 23, 2009 12:20 AM
Subject: Re: [Coco] Microware C Compiler port
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 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
> William Astle
Coco mailing list
Coco at maltedmedia.com
More information about the Coco