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