home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / pascal / 6612 < prev    next >
Encoding:
Text File  |  1992-11-15  |  1.7 KB  |  32 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!spool.mu.edu!umn.edu!csus.edu!netcom.com!gabriel
  3. From: gabriel@netcom.com (Gabriel Beccar-Varela)
  4. Subject: BP 7.0 warning
  5. Message-ID: <1992Nov16.040723.8740@netcom.com>
  6. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  7. Date: Mon, 16 Nov 1992 04:07:23 GMT
  8. Lines: 22
  9.  
  10. A few days ago I reported problems with TV 2.0 and its apparent 
  11. inability to read stringlists if they were created with TV 1.0.
  12. I discovered the source of the problem and I am reporting the
  13. solution because it could very easily happen to others: I innocently
  14. set the open parameters flag on in the Options|Compiler dialog.
  15. After reading the documentation it seemed harmeless enough. It looked
  16. to me more or less like a duplication of the $V- compiler directive.
  17. It turned out that one of the parameters of the TStringList.Read 
  18. method (which is private so you have to look at the source code) is
  19. "var S : string". By compiling with Open Parameters on (i.e. $P+), the
  20. "var S : string" was transformed into "var S : OpenString". Now,
  21. OpenStrings cannot be passed as regular variable parameters to other
  22. procedures and functions (see Language Guide, p. 113). Since
  23. TStringList.Read is called by TStringList.Get, the OpenString parameter
  24. created havoc (some sort of memory overwrite).
  25. The lesson from this is: do not recompile OBJECTS.PAS with $P+.
  26. I discovered all this almost by chance. I did not see anything in Borland's
  27. documentation which will help you avoid this kind of problem. If it is
  28. so crutial to compile OBJECTS.PAS with $P-, that directive should have
  29. been inserted there with a warning "{do not change this directive}".
  30.  
  31.  
  32.