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,3b7846f658978a27 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Received: by 10.101.179.3 with SMTP id g3mr2739531anp.1.1344998912965; Tue, 14 Aug 2012 19:48:32 -0700 (PDT) Path: c6ni115601339qas.0!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nrc-news.nrc.ca!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: can Ada give run-time error or warning for integer division with non-zero remainder? Date: Sun, 12 Aug 2012 07:45:52 +0200 Organization: A noiseless patient Spider Message-ID: <50274310.80007@adalog.fr> References: Mime-Version: 1.0 Injection-Info: mx04.eternal-september.org; posting-host="cde0054f05a4d4958ef5363f6c36ea72"; logging-data="22158"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19RvLkolW+x74QauoLw0coW" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: Cancel-Lock: sha1:gjU6Fai/OKHmqTdDjXpmlVEJatY= X-Enigmail-Version: 1.4.3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: 2012-08-12T07:45:52+02:00 List-Id: Le 12/08/2012 03:14, Nasser M. Abbasi a �crit : > > In Ada when dividing 2 integers, the result is an integer > with the remainder ignored. Hence 3/2 gives 1 > [...] > Is there any kind of run-time switch to tell it to > check for this? I know I can always add logic myself to > check for this in the code, using rem() for example (which > might be the better solution actually) but I was just > wondering if there is a run-time switch for this. > Fortunately not! Dividing integers uses the integer division. If you want something else, don't use integer division. Having the outcome of an operation depend on a switch would imply that you cannot predict the result of a program by reading it! -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr