help - Cygwin, gcc, newlib and using printf to output unsigned long long int

Jeff Johnston jjohnstn@redhat.com
Fri Jun 11 03:34:00 GMT 2004


Eryk Furman wrote:
> Hello all!  Can any one answer this mystery?  I am using cygwin, gcc, g++ to compile in a dos
> window in WinXP pro.  I am working with an existing GNU project that has a bunch of Makefiles.  I
> added a little code using “unsigned long long int” right now I’m simply declaring a constant ull
> and using printf to output it.  Well it always gets shushed into a long.  I have searched and
> searched the net and read this and that about the printf in newlib not supporting this.  The
> kicker is when I create a file “test.c” and do “gcc test.c” 
> 
> test.c
> //////////////////////////////////////////////////////////
> #include <stdio.h>
> #include <string.h>
> 
> 
> int putitout () {
> 
>         unsigned long long int test = 9888994872930475ull;
>         printf("%llu", test);
> 	return 0;
> }
> 
> 
> int main () {
> 	putitout();
> 	return 0;
> }
> ////////////////////////////////////////////////////////////////
> 
> and run a.exe it prints perfectly.  So my thinking is that somewhere in the makefiles of the
> project the ability for printf to format long long is turned off.  Does this make sense.  What
> command would do this?  What should I look for?  Does any one have any thoughts on this?
> 
> I am completely lost here. 
> Any and all help is much apprecieated.
> 
> Thank you all in advance.
> 
> -Eryk
>

Eryk,

   Newlib does have optional long long output support.  The ability to output 
long long by newlib is determined at configuration time when you build newlib 
itself.  You don't turn it on/off at link time or runtime.  For cygwin, the 
feature is defaulted to enabled.

   I would suggest you check your build to ensure that you are using the same 
gcc and library that you are using when you try your small test.

-- Jeff J.
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Friends.  Fun.  Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/ 



More information about the Newlib mailing list