comp.lang.ada
 help / color / mirror / Atom feed
From: ddciiny!jls@uunet.uu.net  (Jonathan Schilling)
Subject: Re: Precedence Rules (was Re: Software vendors not using Ada but C)
Date: 25 Jun 93 15:09:30 GMT	[thread overview]
Message-ID: <C96nFu.F4r@ddciiny.UUCP> (raw)

In article <20cajmINNqeb@umbc4.umbc.edu> berman@umbc.edu (Mike Berman) writes:
>
>Also, (I've always wanted to ask this), does anyone really use mod and
>rem with negative operands?

Probably not.  But people do use mod with types that include negative
numbers (like INTEGER), and unless the compiler is able to figure out
that the operands have non-negative values, a fair amount of code will
be generated for mod.  This is because the semantics for mod do not
match the semantics of most machines' divide and remainder instructions,
for negative numbers.

Thus, it is a good habit to only use mod with non-negative subtypes,
or to avoid mod and use rem (unless you really have negative operands
and care about the semantics).

-- 
Jonathan Schilling
DDC-I, Inc.
uunet!ddciiny!jls

             reply	other threads:[~1993-06-25 15:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-06-25 15:09 Jonathan Schilling [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-06-29  4:06 Precedence Rules (was Re: Software vendors not using Ada but C) Michael Feldman
1993-06-29  3:23 cis.ohio-state.edu!math.ohio-state.edu!sdd.hp.com!network.ucsd.edu!munnar
1993-06-25 20:50 Michael Feldman
1993-06-24 20:18 cis.ohio-state.edu!news.sei.cmu.edu!jbg
1993-06-24 15:22 magnesium.club.cc.cmu.edu!news.sei.cmu.edu!ae
1993-06-24 13:35 agate!howland.reston.ans.net!darwin.sura.net!haven.umd.edu!news.umbc.edu!
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox