🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.tools.mfc
Article #18

Re: Newbie pointer question

#18
From: Tim Hollebeek
Date: Wed, 20 Sep 1995 01:21
31 lines
1620 bytes
In article <Pine.SUN.3.91.950919124849.1948C-100000@achilles>,
Brandon Wallace  <brandon@criterion.com> wrote:
>On Sun, 10 Sep 1995, Vashist Worah wrote:
>
>-> This may seem trivial to veterans here, but I am trying to figure out 
>-> what in the world is the difference in declaring pointers in the two 
>-> different manners illustrated below (VC++ 2.2):
>-> 
>-> 1)	double*  x
>-> 2)	double  *x
>-> 
>
>THERE IS NO FUNCTIONAL DIFFERENCE
>
>However, some people prefer (1) over (2), some (2) over (1), some don't care.

Answer 1: Brandon is absolutely right.

Answer 2: You should use 2) because if you use the first, you will
probably think that '*' is part of the type, and do something like:

double* x, y; // declares a pointer to double and a plain old double

at least with the * next to the x, it's a bit more obvious that the *
only applies to the x.

-- 
Tim Hollebeek      | Everything above is a true statement, for sufficiently
PChem Grad Student | false values of true.
Princeton Univ.    | C++ == OOP--
-------------------| tim@handel.princeton.edu  http://wagner.princeton.edu/~tim
Technical Details
Message-ID: <43nqb8$c2i@cnn.Princeton.EDU>
Path: arc1-ca.pugleaf.net!cnn.Princeton.EDU!franck!tim
References: <9a7cb$d1625.8d@news.tcsmgmt.com> <Pine.SUN.3.91.950919124849.1948C-100000@achilles>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!cnn.Princeton.EDU!franck!tim
From: tim@franck.Princeton.EDU (Tim Hollebeek)
Newsgroups: comp.os.ms-windows.programmer.tools.mfc,comp.os.ms-windows.programmer.win32,comp.lang.c,comp.lang.c++
Subject: Re: Newbie pointer question
Date: 20 Sep 1995 01:21:44 GMT
Organization: Princeton University
Message-ID: <43nqb8$c2i@cnn.Princeton.EDU>
References: <9a7cb$d1625.8d@news.tcsmgmt.com> <Pine.SUN.3.91.950919124849.1948C-100000@achilles>
NNTP-Posting-Host: franck.princeton.edu