This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: printf("%d,%ld",a,b); always prints unsigned
- From: "Gary D. Thomas" <gary dot thomas at mind dot be>
- To: Bob Holmberg <bob_holmberg at yahoo dot com>
- Cc: eCos Discussion <ecos-discuss at sources dot redhat dot com>
- Date: 16 May 2003 15:46:02 -0600
- Subject: Re: [ECOS] printf("%d,%ld",a,b); always prints unsigned
- Organization:
- References: <20030516214055.57811.qmail@web14007.mail.yahoo.com>
On Fri, 2003-05-16 at 15:40, Bob Holmberg wrote:
> Hello,
>
> Under the following conditions:
>
> Target:
> i386, "net" flavor
> eCos:
> 2.0 beta with CVS update 2003-05-12
> Compiler:
> i386-elf-gcc (GCC) 3.2.1 (eCosCentric)
> under Cygwin on win2K
>
> == The following program:
>
> #include <stdio.h>
>
> int main(void)
> {
> int a = -1;
> long b = -1;
> printf("Should show -1,-1 --> %d,%ld\n",a,b);
> }
>
> == has the output:
> Should show -1,-1 --> 4294967295,4294967295
> ==
>
> That's (correctly) 0xFFFFFFFF but it should
> display the signed numbers as "-1".
>
> The interesting parsing is happening in the file:
> language/c/libc/stdio/current/src/output/vfnprintf.cxx
>
> Has anyone else seen this?
>
What do you get if you use "diag_printf()" instead?
--
Gary D. Thomas <gary.thomas@mind.be>
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss