home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / programm / 21974 < prev    next >
Encoding:
Text File  |  1993-01-23  |  2.4 KB  |  73 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!srvr1.engin.umich.edu!saimiri.primate.wisc.edu!ames!kronos.arc.nasa.gov!joshr
  3. From: joshr@kronos.arc.nasa.gov (Joshua Rabinowitz-Summer-91)
  4. Subject: Re: &StringPtr -vs- StringPtr?
  5. Message-ID: <1993Jan22.200837.13294@kronos.arc.nasa.gov>
  6. Sender: usenet@kronos.arc.nasa.gov (Will Edgington, wedgingt@ptolemy.arc.nasa.gov)
  7. Nntp-Posting-Host: mcc2.arc.nasa.gov
  8. Organization: NASA/ARC Information Sciences Division
  9. References: <1993Jan22.165348.11313@novell.com>
  10. Date: Fri, 22 Jan 1993 20:08:37 GMT
  11. Lines: 60
  12.  
  13. In article <1993Jan22.165348.11313@novell.com> damurphy@wc.novell.com (Duane Murphy) writes:
  14. >
  15. >I have received some code (from a source to remain anonyumous) that is 
  16. >supposed to work with MPW and Think C.  The MPW compiler says nothing, 
  17. >but Think C whines about types not matching.  Here is where the problem 
  18. >is:
  19. >
  20. >    Str255    msg1, msg2;
  21. >
  22. >... // code deleted
  23. >
  24. >    GetIndString(&msg1, errResID, errStringIndex);
  25. >
  26. >The problem is &msg1.  The prototype for GetIndString is:
  27. >(from ToolUtils.h)
  28. >
  29. >pascal void GetIndString(Str255 theString,short strListID,short index); 
  30. >
  31. >I have changed the call to:
  32. >
  33. >    GetIndString(msg1, errResID, errStringIndex);
  34.  
  35.  
  36. Try someting like this (it works for me)
  37. GetIndString((ConstStr255Param) msg1, ......
  38.  
  39. Also, note that because msg1 is technically an array of chars, 
  40. msg1 is the address of the first element, and &msg1 has no real
  41. meaning (thoug usually is interpreted as just &msg1[0], or msg1).
  42.  
  43. Sorry, I realize you got this.
  44.  
  45. >
  46. >which seems (to me) to match to prototype better.
  47. >
  48. >Who is right (according to ANSI)?  Is MPW being a slacker?  Is Think C 
  49. >being picky?
  50.  
  51. Think C is being picky.
  52. I would say that if you passed msg1 (not &msg1), it SHOULD accept it.
  53. I believe I usually must cast in that situation as well, though.
  54.  
  55.  
  56. >
  57. >
  58. >Thanks,
  59. >...Duane
  60. >
  61. >  +------------------------+--------------------------------------------+
  62. >  | Duane Murphy           | My opinions are mine, mine, and only mine; |
  63. >  | damurphy@wc.novell.com |      Except when they are also yours.      |
  64. >  | Macintosh Software QA  |                                            |
  65. >  +------------------------+--------------------------------------------+
  66.  
  67.  
  68. -- 
  69. ----------------------------------
  70. #include <std/disclaimer.h>     Josh Rabinowitz, Mac TCL programmer
  71. joshr@kronos.arc.nasa.gov
  72. "Me lost my cookie at the disco." -- Cookie Monster
  73.