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-Thread: 103376,24d7acf9b853aac8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!news.mv.net!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: S-expression I/O in Ada Date: Sun, 08 Aug 2010 11:34:23 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <547afa6b-731e-475f-a7f2-eaefefb25861@k8g2000prh.googlegroups.com> <1qk2k63kzh7yv$.3jgc403xcqdw$.dlg@40tude.net> <8ae8e899-9eef-4c8c-982e-bfdfc10072f1@h17g2000pri.googlegroups.com> <258zlxrv4fn6.1vszho1rtmf48$.dlg@40tude.net> <984db477-973c-4a66-9bf6-e5348c9b95f2@n19g2000prf.googlegroups.com> <46866b8yq8nn$.151lqiwa0y2k6.dlg@40tude.net> <13b07f2c-2f35-43e0-83c5-1b572c65d323@y11g2000yqm.googlegroups.com> <13tpf7ya3evig$.h05p3x08059s$.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1281281649 25842 192.74.137.71 (8 Aug 2010 15:34:09 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 8 Aug 2010 15:34:09 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:vZKydOHSfGB7mObw5+NMt3ndeo8= Xref: g2news1.google.com comp.lang.ada:12959 Date: 2010-08-08T11:34:23-04:00 List-Id: Natacha Kerensikova writes: > (probably Integer mod 2**16 or something like that). There's no such thing as "Integer mod 2**16". "mod ..." is how you declare an unsigned integer type (called "modular type" in Ada), and "range ..." is how you declare a signed integer type. Integer is a predefined signed integer type. It's range is not portable, so if you care about that, it should be avoided. It's a good idea to declare your own integer types -- different types for different purposes. For example, if you have an array of indexes into another array, using different index types for the two arrays will often make the code readable -- it will be obvious that (say) X is intended for indexing into the outer array. Modular types are evil, and should usually be avoided. You might want modular types when interfacing with C code, but don't use them just because you happen to have no negative numbers. For example, I would usually (not always!) prefer this: type Octet is range 0..2**8-1; -- signed over this: type Octet is mod 2**8; -- unsigned The index type of an unconstrained array should (almost) never be modular. - Bob