home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!mcsun!fuug!kiae!relcom!usenet
- From: als@vl.ts.kiev.ua (Alexander Shehovtsov)
- Subject: Re: TPv5.5 optimizations--Constant Folding?
- Message-ID: <AAZP8RgO91@vl.ts.kiev.ua>
- Lines: 24
- Sender: news-service@kiae.su
- Reply-To: als@vl.ts.kiev.ua
- Organization: TechnoSoft
- References: <BrLqJ4.2oK@news.cso.uiuc.edu>
- Date: Tue, 21 Jul 92 17:49:23 -0400
-
- > If I have string literals strewn about my code will the v5.5 Turbo Pascal
- > compiler replace subsequent occurances with a pointer instead of duplicating
- > the literal?
- >
- > Ie, if the statement: " errmsg := 'Unknown command,'; " occurs 20 times,
- > (exactly the same in each case), will the string be stored once or 20 times?
- >
- Yes! And it's easy to optimize this assignment, defining somewhere
- global typed constant:
-
- CONST
- ErrorMessage : string[17] = 'Unknown command';
-
- and then writing such statements:
-
- errmsg := ErrorMessage;
-
-
- --
- Alexander Shehovtsov, (044) 266-70-28 (9:00 - 18:00 Kiev, Ukraine) voice
- als@vl.ts.kiev.ua Relcom | 2:463/30.5 or 2:463/34.4 FidoNet
-
-
-
-