tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] parameter declarations and long doubles


From: Jim Cook
Subject: Re: [Tinycc-devel] parameter declarations and long doubles
Date: Thu, 8 Jun 2006 08:36:11 -0700

For example 6.5.2.2 suggests that the call is okay, because the
promoted argument type (int) is compatible with the promoted parameter
 
Is there an online reference for 6.5.2.2, et al.? I don't have a dead-tree version handy and would be more than happy to research such things myself before posting questions.
 
My guess is that it _is_ a tcc bug.  The best and easist workaround is
to never use old-style function definitions in the first place.  It's
been 17 years since prototypes were standardized, after all.
 
I absolutely agree with you here.
 
Thank you very much for your well explained and referenced answer! I truly appreciate the effort you spent.
 

>    long double ld = 3.14;
[...]
>    printf("%lf\n", ld);

For long double you should use %Lf, not %lf.  Also, keep in mind that
the actual implementation of "printf" is provided by the system's C
library, not tcc.
 
 
This answer gave me pause for a while until I realized you meant that when the TCC binary was compiled, it was _that_ compiler that is responsible. In the Windows binary port mentioned on the TCC page http://fabrice.bellard.free.fr/tcc/
 
http://laurenssimonis.com/tcc/tcc-0.9.23.zip
Windows binary distribution maintained by Laurens Simonis.

It appears that using either %lf or %Lf has the same result when passed a long double. Both show - 30329013470004487000000000000000000000000000.000000 when long double ld = 3.14; is passed in. So I'll just stick with double I don't have actual reasons for using long double, but was putting TCC through the paces.

Do you have an online reference for the right printf arguments? The one I found was on msdn.microsoft.com and said that both %lf and %Lf were equivalent and both took long double. I also happen to know that in the compilers from them, long double and double are not different, so perhaps that's part of the strangeness.
Again, thank you ever so much for your response.

--
Email me if you want a gmail account.
2006 Tuesdays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Wednesday.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]