comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: About conversions
Date: 2000/11/22
Date: 2000-11-22T00:00:00+00:00	[thread overview]
Message-ID: <8vgoek$p1r$1@nnrp1.deja.com> (raw)
In-Reply-To: 8vfjhn$t4e$1@nnrp1.deja.com

In article <8vfjhn$t4e$1@nnrp1.deja.com>,
  Robert Dewar <robert_dewar@my-deja.com> wrote:
> In article <8vetq2$bkb$1@nnrp1.deja.com>,
> Why is it confusing? Simple, most people think of conversions
> as basically function calls, and it is peculiar to have a
> function call as an Lvalue. (peculiar in Ada as well, and indeed

I prefer to think of them as a kind of in-line compiler directive, in
effect saying "think of this object as really being of this type". I
generally tell this to others as well, since thinking of it as a
function call leads people to the erronious conclusion that the
conversion is liable to have some kind of subprogram-like overhead.

From this point of view, *not* allowing it for "out" parameters would be
confusing. (And yes, to this way of thinking it is a bit odd that you
can't use it on the left side of an assignment).

> -14 mod 5

Not a chance. I don't think I've ever needed to use "mod" for negative
numbers, so I would definitely have to look it up. That's just a matter
of use though. If I had to do it all the time, I'm sure I'd know it just
as well as a heavy C coder knows how to properly use the "?" operator.

Pretty much the only time I ever use "mod" is to index into circular
data structures. Occasionly I'll use it to effect a bit mask on an
unsigned value. There's probably a use for applying it to signed values,
but I haven't encountered it in 11 years.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




  reply	other threads:[~2000-11-22  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-20  0:00 About conversions Sandro Binetti
2000-11-20  0:00 ` Ken Garlington
2000-11-20  0:00   ` Robert Dewar
2000-11-20  0:00     ` Stephen Leake
2000-11-21  0:00       ` Robert Dewar
2000-11-21  0:00         ` Warren W. Gay VE3WWG
2000-11-21  0:00           ` Robert Dewar
2000-11-21  0:00             ` Ted Dennison
2000-11-22  3:27               ` Warren W. Gay VE3WWG
2000-11-22  4:54               ` Robert Dewar
2000-11-22  0:00                 ` Ted Dennison [this message]
2000-11-22  0:00                 ` Wes Groleau
2000-11-22  0:00         ` Tristan Gingold
2000-11-24  0:00         ` Jean-Pierre Rosen
2000-11-24  0:00       ` Jean-Pierre Rosen
2000-11-21  2:57     ` DuckE
2000-11-21  0:00       ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
2000-11-23  6:21 Christoph Grein
2000-11-23  0:00 ` Wilhelm Spickermann
2000-11-23  0:00   ` Florian Weimer
2000-11-23  0:00     ` Wilhelm Spickermann
2000-11-28  2:20   ` Robert Dewar
2000-11-24  0:00 Christoph Grein
2000-11-28  1:33 ` Robert Dewar
replies disabled

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