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: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!news.stack.nl!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Clubley Newsgroups: comp.lang.ada Subject: Re: Integer Overflow Question. Date: Mon, 25 Aug 2014 17:40:58 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <9c5de333-276c-4e3a-be5a-4e5a98cdaa1d@googlegroups.com> <440bf1f1-3e98-47ac-b0c0-f73f170a3603@googlegroups.com> <55b1078f-dc26-4ae0-ac9f-5af0bfd90992@googlegroups.com> <84ce2caf-0a48-4952-8703-af1c0fabe583@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Date: Mon, 25 Aug 2014 17:40:58 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="d98b47d2616099aab4de9db7f87c59ee"; logging-data="11129"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/YNsoFxhIk/MgUf/SXzf8cu/rOEj/bZsg=" User-Agent: slrn/0.9.9p1 (Linux) Cancel-Lock: sha1:UjI5APctFkwCnh9TnX6gdSOer6c= Xref: number.nntp.dca.giganews.com comp.lang.ada:188659 Date: 2014-08-25T17:40:58+00:00 List-Id: On 2014-08-25, austin.obyrne769@btinternet.com wrote: > On Monday, August 25, 2014 2:34:29 PM UTC+1, Aay Jay Chan wrote: >> From the fact that you don't know how big your types are, it sounds like you are using pre-defined types. In Ada, the prefered way is to define your own types with the range that matches your requirements. That way, you will know, at compile time, whether the compiler can implement those types on the target platform. > > Apologies > > I haven't just learned that I can do that. > > I have indeed been using pre-defined integers and was quite unaware > that I could define my own types with a suitable range - I have only > just learned that from another source. > Austin, the following is a polite and well intentioned suggestion. User defined data types with user defined ranges are a core capability within Ada's range of features. Although I am a professional programmer, my interest in Ada is only personal, and not work related. However, that doesn't change the fact I found out about this capability within Ada very shortly after starting to explore Ada years ago. My suggestion is for you to pick up an Ada book or maybe look at an online resource and learn about the other things Ada can do. When I was beginning Ada I found things like Ada Distilled to be of interest and I see it is still online in various forms. I also have paper books such as the Barnes "Programming in Ada 95", second edition and "Ada as a second language" by Cohen in my library. I would recommend you start with Ada Distilled and see how you get on with that before buying any books. Also, before buying any books, I recommend you ask here for advice on what the current recommended books are. The Ada reference manual is also available online and for downloading. > You see, I am not a well informed programmer and I am also pre-occupied with the maths and the cryptography as well as The Ada side of things. > If you are creating crypto schemes, you _really_ need to be skilled in your implementation language of choice. > Please Mr Chan, > > Could you please set out the Ada-95 sourcecode for defining an integer variable called "CipherText" in the range say of 8 decimal digits to 12 decimal digits. I can do the others myself once I know what to do. > If you don't know this about Ada, it's not something which should be done by rote. However, if you work through an Ada introduction, this basic capability is something you should be able to do yourself. Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world