TIP: Click on subject to list as thread! ANSI
echo: delphi
to: BRYAN SMITH
from: JUD MCCRANIE
date: 1997-06-30 15:13:00
subject: RE: PROBLEM WITH SETS

 Jv>> Do it this way and it will work and it's much easyer to understand:
 Jv>> const
 Jv>>     Key       =  ['O'..'9', '*', '#' ];
 Jv>> var
 Jv>>     userinput : char;
 Jv>> begin
 Jv>>   Read(userinput);
 Jv>>   if userinput in Key then
 BS> The problem with doing it that way - at least with Turbo Pascal 7 - is 
 BS> that the code generated wastes time re-constructing that set of 
 BS> characters every time you hit it. Slowly, too - it adds the characters 
 BS> to the set one-by-one. If your test is inside a loop, that may not be a 
 BS> wise thing to do. 
I thought that TP7 did optimize the sets, but I may be wrong.
Anyhow, how long will it take on , say, a 90 MHz Pentium to
construct the set above compared to the time for the line
    Read(userinput);
Jud McCranie
 * Silver Xpress V4.3 SW20178
--- PCBoard (R) v15.3/M 5
---------------
* Origin: Riverdale, Ga (1:133/9024)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.