home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!fuug!news.funet.fi!hydra!klaava!wirzeniu
- From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
- Newsgroups: comp.lang.c
- Subject: Re: Help!!! Please Read this message!?!?!?!?!...
- Message-ID: <1992Sep11.131151.891@klaava.Helsinki.FI>
- Date: 11 Sep 92 13:11:51 GMT
- References: <1992Sep9.085352.8755@vax.oxford.ac.uk> <1992Sep10.040600.27065@blaze.cs.jhu.edu> <MJN.92Sep11001608@pseudo.uucp>
- Organization: University of Helsinki
- Lines: 21
-
- mjn@pseudo.uucp (Murray Nesbitt) writes:
- > printf( "%f...%s?\n", (float)f, "Huh?" );
- >
- >It's another matter whether you'd *want* to pass a float to printf(),
- >but it is possible.
-
- No, not possible. You can cast a value to float, but before it is
- passed as a parameter, it is automatically and unavoidably converted
- into a double. All arguments to functions with no prototype, or a
- prototype that does not specify any arguments, or arguments that are
- part of the variable part of a variable arguments list, undergo the so
- called ``default promotions'', in which, basically (I may have a few
- details wrong, especially about signed/unsigned promotions) integers
- smaller than int become int and float becomes double. The same
- promotions happen to values that are used in expressions.
-
- (This is probably better described in a good book on C, or by one of the
- gurus in this newsgroup.)
-
- --
- Lars.Wirzenius@helsinki.fi
-