home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / c / 13527 < prev    next >
Encoding:
Internet Message Format  |  1992-09-11  |  1.3 KB

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