From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,37956b356498633 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-03 12:14:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.cwix.com!newscon02.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr14.news.prodigy.com.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Converting Char to Enum References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 67.115.104.57 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr14.news.prodigy.com 1015186393 ST000 67.115.104.57 (Sun, 03 Mar 2002 15:13:13 EST) NNTP-Posting-Date: Sun, 03 Mar 2002 15:13:13 EST Organization: Prodigy Internet http://www.prodigy.com X-UserInfo1: [[PAPDONAJUMB_LY@BCBNWX@RJ_XPDLMN@GZ_GYO^RR@ETUCCNSKQFCY@TXDX_WHSVB]ZEJLSNY\^J[CUVSA_QLFC^RQHUPH[P[NRWCCMLSNPOD_ESALHUK@TDFUZHBLJ\XGKL^NXA\EVHSP[D_C^B_^JCX^W]CHBAX]POG@SSAZQ\LE[DCNMUPG_VSC@VJM Date: Sun, 03 Mar 2002 20:13:13 GMT Xref: archiver1.google.com comp.lang.ada:20735 Date: 2002-03-03T20:13:13+00:00 List-Id: > convert : constant array(characters) of symbols := ... > ... >"sym := convert(char)"? > ... >In this case, how I catch invalid characters? OK : constant array(Character) of Boolean := ('0' | '1' | 'B' | 'T' | 'U' => True, others => False); if OK(char) then sym := convert(char);else ... Note that this is an example of trading away memory to gain speed and, in this case, lose complexity. You should always consider the possibility and desirability of such a tradeoff whenever you decide how to code something.