Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #14790

Re: use of pointers

From glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups comp.lang.c++
Subject Re: use of pointers
Date 2012-03-06 20:56 +0000
Organization Aioe.org NNTP Server
Message-ID <jj5tm8$faa$1@speranza.aioe.org> (permalink)
References <0ea866f3-d443-4014-93fe-507d76ee6528@em9g2000vbb.googlegroups.com> <4f560345$0$3087$7b1e8fa0@news.nbl.fi> <jj521m$ih2$1@dont-email.me> <jj55ii$c4e$2@speranza.aioe.org> <jj5dpp$rov$1@dont-email.me>

Show all headers | View raw


Victor Bazarov <v.bazarov@comcast.invalid> wrote:
 (snip, someone wrote)
>>> The name 'Point' is misleading IMNSHO and so is the name of the
>>> function.  What is returned is a velocity vector, not a position.

>> I suppose, but you could just consider it a point in velocity space.

> I could.  But somebody who will likely assign a velocity "point" to a 
> two-dimensional spatial (planar) point, shouldn't.  There is no "space" 
> designation in the type, is there?

I expect that you will find that some people think one way one
some the other. Note that it is unusual (there might be one) for
programming languages to keep track of dimensional units.

Physics has, in addition to velocity space, which might not seem
too strange, momentum space. There are some problems that can easily
be solved if you think of them in momentum space. (Even 
relativistically when it isn't mass times velocity anymore.)

>>> And I am not so sure one couldn't just return std::pair<float,float>
>>> since it essentially does the same thing, except that its members are
>>> not called 'x' and 'y'...  Why invent another type when a standard one
>>> exists?

>> But velocity also has x and y components, so Point is fine.

> <sigh> It isn't.  But I don't see any use of arguing.  Not anymore. 
> Sorry I brought it up.

I have thought for some time now, that it is more usual for
physicists to include units in their variables, and for engineers
to factor them out.

In a physics book you will see F=ma.

In an engineering book F(Newtons) = m(kg) * a (m/s**2)

In the latter case, the variable holds the unitless value that,
when the specified unit is applied, has the appropriate value
and dimensions.

Now, with a name like Point, one could ask why it is 2D and
not 3D, or even 4D. You could name the class Vector2D, though.

-- glen

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

use of pointers ahso <ahso47@yahoo.com> - 2012-03-06 02:54 -0800
  Re: use of pointers Marcel Müller <news.5.maazl@spamgourmet.com> - 2012-03-06 12:22 +0100
    Re: use of pointers nick_keighley_nospam@hotmail.com - 2012-03-07 00:32 -0800
      Re: use of pointers Juha Nieminen <nospam@thanks.invalid> - 2012-03-07 13:47 +0000
        Re: use of pointers nick_keighley_nospam@hotmail.com - 2012-03-07 07:06 -0800
          Re: use of pointers Juha Nieminen <nospam@thanks.invalid> - 2012-03-07 16:04 +0000
  Re: use of pointers Juha Nieminen <nospam@thanks.invalid> - 2012-03-06 12:29 +0000
    Re: use of pointers Victor Bazarov <v.bazarov@comcast.invalid> - 2012-03-06 08:04 -0500
      Re: use of pointers glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-03-06 14:05 +0000
        Re: use of pointers Victor Bazarov <v.bazarov@comcast.invalid> - 2012-03-06 11:25 -0500
          Re: use of pointers glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-03-06 20:56 +0000
      Re: use of pointers SG <s.gesemann@gmail.com> - 2012-03-06 06:27 -0800
        Re: use of pointers BGB <cr88192@hotmail.com> - 2012-03-06 13:05 -0700
        Re: use of pointers woodbrian77@gmail.com - 2012-03-07 05:38 -0800
      Re: use of pointers Rui Maciel <rui.maciel@gmail.com> - 2012-03-07 15:48 +0000
        Re: use of pointers BGB <cr88192@hotmail.com> - 2012-03-07 18:38 -0700
          Re: use of pointers Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2012-03-10 21:10 -0500
            Re: use of pointers Jeff Flinn <TriumphSprint2000@hotmail.com> - 2012-03-12 08:26 -0400
              Re: use of pointers Jeff Flinn <TriumphSprint2000@hotmail.com> - 2012-03-12 12:28 -0400
      Re: use of pointers Nobody <nobody@nowhere.com> - 2012-03-09 21:28 +0000
  Re: use of pointers Geoff <geoff@invalid.invalid> - 2012-03-06 21:31 -0800
    Re: use of pointers Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-03-07 11:26 +0000
      Re: use of pointers yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2012-03-07 13:56 +0000
        Re: use of pointers Maarten <maarten.sneep@knmi.nl> - 2012-03-07 06:14 -0800
          Re: use of pointers Rui Maciel <rui.maciel@gmail.com> - 2012-03-07 16:05 +0000
            Re: use of pointers yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2012-03-08 10:08 +0000
              Re: use of pointers Rui Maciel <rui.maciel@gmail.com> - 2012-03-08 21:17 +0000
            Re: use of pointers Maarten <maarten.sneep@knmi.nl> - 2012-03-08 04:55 -0800
          Re: use of pointers Nobody <nobody@nowhere.com> - 2012-03-09 21:45 +0000
        Re: use of pointers Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-03-07 20:08 +0000
      Re: use of pointers Nobody <nobody@nowhere.com> - 2012-03-09 21:50 +0000
        Re: use of pointers Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-03-09 22:37 +0000
  Re: use of pointers Rui Maciel <rui.maciel@gmail.com> - 2012-03-07 15:37 +0000

csiph-web