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=unavailable autolearn_force=no version=3.4.4 Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!news.albasani.net!.POSTED!not-for-mail From: Martin Trenkmann Newsgroups: comp.lang.ada Subject: Implementing character sets for Wide_Character Date: Fri, 06 Mar 2015 19:01:33 +0100 Organization: albasani.net Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net 2Qikjw61X5LZdh84iL9lLauY7Y2lrEgHfWqB8MAd2VWhzcv9aMvJAjmob961o1ku0ig9PqoB33qo9k7VufpUOg== NNTP-Posting-Date: Fri, 6 Mar 2015 18:01:34 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="H73Kh6aWBXHchcqocFYf8iYuo0J7wjCcsl3Adw/LS5BBAQBxhuDUyeM8/RiUS9r7BzAB7dhDbGjqK5G8DZhVyJtVKH3O7V45lzlqyRlpvOBSquYeZglEzouXUa7aYllB"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 Cancel-Lock: sha1:pETUOrs1Ge8Kis7lvRBwMDmd08w= Xref: number.nntp.giganews.com comp.lang.ada:192433 Date: 2015-03-06T19:01:33+01:00 List-Id: I need to implement a containment check for Wide_Character in a wide character set. I have two approaches in mind. 1. Using an array type similar to Ada.Strings.Maps.Character_Set. type Wide_Character_Set is array (Wide_Character) of Boolean with Pack; XYZ_Charset_Set : constant Wide_Character_Set := (Wide_Character'Val (100) .. Wide_Character'Val (900) => True, others => False); 2. Using a function with a case statement. function Is_In_XYZ_Charset_Set (Item : Wide_Character) return Boolean is begin case Item is when Wide_Character'Val (100) .. Wide_Character'Val (900) => return True; when others => return False; end case; end Is_In_XYZ_Charset_Set; I know that using an array will consume more memory, but with the Pack aspect it should only be 8 KB - please correct me if I am wrong. The function approach is more memory friendly, but might be a bit slower as an array lookup. Should I definitely avoid one of the solutions or is just a matter of available memory? Thanks for your help. Martin