home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / mac / programm / 13059 < prev    next >
Encoding:
Text File  |  1992-07-27  |  1.9 KB  |  59 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!stanford.edu!kronos.arc.nasa.gov!joshr
  3. From: joshr@kronos.arc.nasa.gov (Joshua Rabinowitz-Summer-91)
  4. Subject: Re: THINK C 5.0 Code overflow
  5. Message-ID: <1992Jul27.182827.19459@kronos.arc.nasa.gov>
  6. Keywords: error,C programming, THINK C 5.0, Mac
  7. Sender: usenet@kronos.arc.nasa.gov (Will Edgington, wedgingt@ptolemy.arc.nasa.gov)
  8. Nntp-Posting-Host: kronos-arclan.arc.nasa.gov
  9. Organization: NASA/ARC Information Sciences Division
  10. References: <1992Jul27.160800.18222@cs.few.eur.nl> <1992Jul27.172249.17584@news.iastate.edu>
  11. Date: Mon, 27 Jul 1992 18:28:27 GMT
  12. Lines: 45
  13.  
  14. In article <1992Jul27.172249.17584@news.iastate.edu> niko@iastate.edu (Nikolaus E Schuessler) writes:
  15. >In article <1992Jul27.160800.18222@cs.few.eur.nl> christ@cs.few.eur.nl (Christ Leijtens) writes:
  16. >
  17. >>         Question: Is there *any* way to get around this  bound  for
  18. >>   the  code and data, so we can continue porting the program to the
  19. >>   Macintosh? We would like any information on porting programs from
  20. >>   other implementation of the C-language to Macintosh THINK C 5.0.
  21. >>
  22. >
  23. >Yes, there is... You have to declare all arrays as pointers to arrays
  24. >and malloc them in a routine at the start of your program... A * real *
  25. >pain ...
  26. >
  27. >char x[1000];
  28. >
  29. >to char *x;
  30. >
  31. >...
  32. >
  33. >x = (char *) malloc(1000 * sizeof(char))
  34.  
  35.  
  36. Ummm, are you sure this is what you mean?  it gets an array of 1000 chars
  37. from local memory, then again from malloc.  In addition, isn't x, as declared,
  38. a constant pointer (my language may be incorrect, but i STRONGLY suspect
  39.                the above code of being not what you meant).
  40.  
  41. What I think you menat was
  42.  
  43. {
  44.  ...
  45.  char *x;
  46.  x = (char *) malloc(1000 * sizeof(char));
  47.  
  48. }
  49.  
  50. right?
  51. >
  52.  
  53.  
  54. -- 
  55. ----------------------------------
  56. #include <std/disclaimer.h>     Josh Rabinowitz, Mac TCL programmer
  57. joshr@kronos.arc.nasa.gov
  58. "'I see', said the blind carpenter, as he picked up his hammer and saw".
  59.