gcc error ?
Derfinak Jan
derfinak na hron.fei.tuke.sk
Čtvrtek Říjen 30 13:49:33 CET 1997
On Thu, 30 Oct 1997, mao wrote:
> chci se zeptat jestli by nekdo nevysvetlil tohle:
>
> #include <stdio.h>
> #include <stdarg.h>
> #include <math.h>
>
>
> void foo( char *fmt, ... )
> {
> va_list ap;
> float f;
>
> va_start( ap, fmt );
> f = va_arg( ap, float );
f = va_arg( ap, double);
info libc:
Furthermore, this argument's type must be "self-promoting": that is,
the default promotions must not change its type. This rules out array
and function types, as well as `float', `char' (whether signed or not)
and `short int' (whether signed or not). This is actually an ANSI C
requirement.
> printf(" predany float je: %f\n", f );
> va_end( ap );
> }
>
> void main()
> {
> float f;
>
> f=3.14;
> if ( f!=3.14 )
if (f! = (float)3.14 )
Toto je jasne.
> printf(" Error 3.14!=%f\n", f ); /*to je jedna vec*/
>
> foo( "Test Floatu", f );
> }
>
> me to udelalo:
> 3.14!=3.140000
> predany float je: 834722443.2432524
Teraz je vysledok:
predany float je: 3.140000
jano
----- I can't get no satisfaction -----
Rolling Stones
Další informace o konferenci Linux