home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20065 < prev    next >
Encoding:
Internet Message Format  |  1993-01-22  |  1.4 KB

  1. Path: sparky!uunet!gatech!enterpoop.mit.edu!eru.mt.luth.se!kth.se!news.kth.se!harald
  2. From: harald@marilyn.bion.kth.se (Harald Winroth)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Unwanted float to double conversion in variable length arg lists?
  5. Message-ID: <HARALD.93Jan22133850@marilyn.bion.kth.se>
  6. Date: 22 Jan 93 12:38:50 GMT
  7. References: <C18924.2yp@inews.Intel.COM>
  8. Sender: usenet@kth.se (Usenet)
  9. Organization: Royal Institute of Technology, Stockholm, Sweden
  10. Lines: 18
  11. In-Reply-To: dmarer@td2cad.intel.com's message of 21 Jan 93 23:25:15 GMT
  12. Nntp-Posting-Host: marilyn.bion.kth.se
  13.  
  14. In article <C18924.2yp@inews.Intel.COM> dmarer@td2cad.intel.com (Dennis Marer) writes:
  15.  
  16. >  I've got a curious problem when passing floats in a variable length argument
  17. >  list...they are automatically converted to doubles, EVEN when I typecast.
  18. >  Consider:
  19.  
  20. From K&R, 2nd ed:
  21.  
  22. ...trailing arguments beyond the explicitly typed parameters suffer default
  23. argument promotion...
  24.  
  25. which means that all float parameters corresponding to ... are promoted to 
  26. doubles (just like ALL float parameters were promoted in old K&R C).
  27.  
  28. -----------------------------------------------------------------------------
  29. Harald Winroth      |  Computational Vision and Active Perception Laboratory,
  30. harald@bion.kth.se  |  Royal Institute of Technology, Stockholm, Sweden.
  31. -----------------------------------------------------------------------------
  32.