home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14574 < prev    next >
Encoding:
Text File  |  1992-08-26  |  1.7 KB  |  56 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!cs.utexas.edu!sun-barr!ames!kronos.arc.nasa.gov!joshr
  3. From: joshr@kronos.arc.nasa.gov (Joshua Rabinowitz-Summer-91)
  4. Subject: Re: Why won't this compile under Think C 5.0?
  5. Message-ID: <1992Aug26.221238.6018@kronos.arc.nasa.gov>
  6. Sender: usenet@kronos.arc.nasa.gov (Will Edgington, wedgingt@ptolemy.arc.nasa.gov)
  7. Nntp-Posting-Host: kronos-arclan.arc.nasa.gov
  8. Organization: NASA/ARC Information Sciences Division
  9. References: <T5L3PB3w164w@uuisis.isis.org>
  10. Date: Wed, 26 Aug 1992 22:12:38 GMT
  11. Lines: 43
  12.  
  13. In article <T5L3PB3w164w@uuisis.isis.org> rrwood@uuisis.isis.org (Roy Wood) writes:
  14. >Okay, I'm feeling frustrated and dumb.  Look at this:
  15. >
  16. >/* ----------------------------------------------------- */
  17. >
  18. >extern void MyFunction(char);
  19. >
  20. >void MyFunction(theChar)
  21. >char theChar;
  22. >{
  23. >     /* do stuff */
  24. >}
  25. >
  26. >/* ---------------------------------------------------- */
  27. >
  28. >Actually, the function prototype is getting pulled in from a #include file,
  29. >and the "extern" doesn't really matter much (i.e. it still doesn't work even
  30. >if I leave it out).  The problem seems to center around the use of the
  31. >"char" data type-- it works with int's, long's, mother's-maiden-names, etc.,
  32. >but not for char's.
  33. >
  34. >So, what gives?
  35. >
  36. >-Roy
  37.  
  38. Try using inline - definitions (is that what they're called?) 
  39. like so:
  40. void MyFunction(char theChar)
  41. {
  42.    /* do stufff */
  43. }
  44.  
  45. possibly the char you pass is being promoted to an int, or some such.
  46. Also, use strict prototype checking (require).
  47. I assume you are using thinkC.
  48.  
  49.  
  50.  
  51. -- 
  52. ----------------------------------
  53. #include <std/disclaimer.h>     Josh Rabinowitz, Mac TCL programmer
  54. joshr@kronos.arc.nasa.gov
  55. "Send a salami to your boy in the army" - Katz's delicatessen, NYC
  56.