home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / pascal / 4552 < prev    next >
Encoding:
Text File  |  1992-07-25  |  1.2 KB  |  37 lines

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