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: a07f3367d7,caabf5265fad78e5 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!news.stack.nl!aioe.org!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: unsigned type Date: Mon, 29 Jun 2009 00:19:07 +0000 (UTC) Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: jsj6/wjO/cHSAHkcGxcp1Q.user.aioe.org X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.7.9 X-Newsreader: Tom's custom newsreader Cancel-Lock: sha1:Em5YD+wbVBLPnduWcPWoFRqPIP4= Xref: g2news2.google.com comp.lang.ada:6693 Date: 2009-06-29T00:19:07+00:00 List-Id: > And as for Natural, well, that is the definition of a String's index false. > and in most cases you use Naturals in "for loop' statements. false. > And if you use the standard types instead of creating your own you > would save problem when another modifies the program! unlikely. > Alway use standard if possible, Most experienced Ada programmers would say the opposite. > That way every program rather Ada or C or etc known the type > and the range. false. I can't count the number of times I had to change a program that assumed that, say, the standard type Integer was 32 bits. (And almost never was it reasonable for a variable of the type in question to have a value of plus or minus a couple of billion.) > Never create your own types unless lives are an issue. Most Ada programmers would say your programs are more likely to be correct if you welcome, rather than refuse, assistance from the compiler. If you define your own types, the compiler can check that you aren't erroneously adding Number_Of_Apples to Miles_Travelled, and that Miles_Travelled is within the reasonable range you specify (not just +- 2**32). If you use a particular compiler version's standard Integer, who knows if it will be the same 3 CPU generation later when your code is still in use and you have long since left that project. A good Ada style guide is http://www.adaic.org/docs/95style/95style.pdf