tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] parameter declarations and long doubles


From: Jim Cook
Subject: [Tinycc-devel] parameter declarations and long doubles
Date: Wed, 7 Jun 2006 17:22:40 -0700

I've just now installed tcc version 0.9.23 and am hoping to use it as a tool while teaching somebody C.
 
In the program below, I would expect the two printf calls in main to generate the same output, but they do not. I would also expect test1 and test2 to produce the same output and they do not.
 
Have I misunderstood something about printf with "%lf"? Can anybody explain why test1 and test2 produce different results?
 
I'm using -Wall -Werror, in case that helps, and using the Windows binary port.
 
 
#include <stdio.h>

static void test1(n)
unsigned char n;
{
    printf("n is %u. n is < 2? %u\n", n, n < 2);
}

static void test2(unsigned char n)
{
    printf("n is %u. n is < 2? %u\n", n, n < 2);
}

int main(int argc, char **argv)
{
    double d = 3.14;
    long double ld = 3.14;
    printf("%f\n", d);
    printf("%lf\n", ld);

    test1(257);
    test2(257);
 return 0;
}



--
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]