home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14617 < prev    next >
Encoding:
Internet Message Format  |  1992-08-27  |  1.4 KB

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!network.ucsd.edu!qualcom.qualcomm.com!qualcom.qualcomm.com!sdorner
  2. From: sdorner@qualcom.qualcomm.com (Steve Dorner)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Why won't this compile under Think C 5.0?
  5. Message-ID: <1992Aug27.173756.13638@qualcomm.com>
  6. Date: 27 Aug 92 17:37:56 GMT
  7. References: <T5L3PB3w164w@uuisis.isis.org>
  8. Sender: news@qualcomm.com
  9. Organization: Qualcomm, Inc., San Diego, CA
  10. Lines: 29
  11. Nntp-Posting-Host: qualcom.qualcomm.com
  12.  
  13. rrwood@uuisis.isis.org (Roy Wood) writes:
  14. >extern void MyFunction(char);
  15.  
  16. This prototype indicates that only a single byte will be pushed on the
  17. stack for the char (in theory; I don't think that can really be done,
  18. can it?).
  19.  
  20. >void MyFunction(theChar)
  21. >char theChar;
  22. >{
  23.  
  24. This is an old-style declaration, which implies promotion from char to
  25. int.  It is the same as writing:
  26.  
  27. void MyFunction(theChar)
  28. int theChar;
  29. {
  30.  
  31. Thus, you have incompatible declarations.
  32.  
  33. Old-style declarations are assumed to use promotion for compatibility
  34. reasons.  Otherwise, compiling your code with an ANSI-aware compiler
  35. would suddenly change the code's behavior, which some people feel is
  36. A Bad Thing.  (Thank god I can write "short i=-1;" now, though.)
  37.  
  38. None of this is specific to THINK C; it's SOP for a C compiler.
  39. -- 
  40. Steve Dorner, Qualcomm, Inc.
  41. Yes, I'm still working on Eudora and it's still free.
  42.