home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / std / c / 2512 < prev    next >
Encoding:
Internet Message Format  |  1992-08-25  |  1.4 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!mips!think.com!barmar
  2. From: barmar@think.com (Barry Margolin)
  3. Newsgroups: comp.std.c
  4. Subject: Re: space optimization involving enum
  5. Message-ID: <17dvn3INNglh@early-bird.think.com>
  6. Date: 25 Aug 92 18:55:31 GMT
  7. References: <spuler.714711530@coral.cs.jcu.edu.au> <1992Aug25.153909.17977@email.tuwien.ac.at>
  8. Organization: Thinking Machines Corporation, Cambridge MA, USA
  9. Lines: 20
  10. NNTP-Posting-Host: telecaster.think.com
  11.  
  12. In article <1992Aug25.153909.17977@email.tuwien.ac.at> hp@vmars.tuwien.ac.at (Peter Holzer) writes:
  13. >When the callee is compiled, the compiler cannot know if there is a
  14. >prototype in scope of the caller.
  15.  
  16. Actually, doesn't the standard require that function
  17. declarations/prototypes and definitions be consistent with each other?  If
  18. the function is defined with an ANSI parameter list, the caller must have a
  19. prototype in scope.  If the function is defined with a K&R1 parameter list,
  20. the caller can use an old-style declaration (or no declaration at all,
  21. letting it default, if the function returns int).
  22.  
  23. In particular, with K&R declarations, chars are always widened to ints when
  24. calling a function, while with ANSI prototypes they're passed as chars.
  25. This is very similar to the enum conversion that you were talking about.
  26.  
  27. -- 
  28. Barry Margolin
  29. System Manager, Thinking Machines Corp.
  30.  
  31. barmar@think.com          {uunet,harvard}!think!barmar
  32.