Article View: comp.os.ms-windows.programmer.tools.mfc
Article #16Re: Newbie pointer question
From: Kit Kauffmann
Date: Thu, 14 Sep 1995 15:22
Date: Thu, 14 Sep 1995 15:22
44 lines
2003 bytes
2003 bytes
In article <43a4pb$8b4@shellx.best.com> netninja@svpal.org (NetNinja) writes: >From: netninja@svpal.org (NetNinja) >Subject: Re: Newbie pointer question >Date: Thu, 14 Sep 1995 21:05:24 GMT >vashist@tcsmgmt.com (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 >>Of course, referencing pointers in the manner >> *x >>yields the value of the variable whose address is stored in the pointer > Well, there is no difference. But, if you are declaring multiple > variables the second style is preferred because it causes less > confusion. > if you say 'double* x, y' that does not mean y is a double pointer, > y is still just a double since the '*' goes with the variable x, > hence it is always better to put it nearer to the variable than the > type > > One could consider this a "religious" issue - I like to define every variable on a separate line (leaving room for a comment), and prefer to put the '*' or '&' next to the data type, indicating that x is a "pointer to double" or whatever... Standards suck! Except mine, of course :) Kit Kauffmann - kitk@mudshark.sunquest.com AKA 73363,447 (Compu$erve) Finger me for my public key
Technical Details
Message-ID:
<kitk.1812.000F628E@mudshark.sunquest.com>Path:
arc1-ca.pugleaf.net!kitk.sunquest.com!kitkReferences:
<9a7cb$d1625.8d@news.tcsmgmt.com> <43a4pb$8b4@shellx.best.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!kitk.sunquest.com!kitk From: kitk@mudshark.sunquest.com (Kit Kauffmann) 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: Thu, 14 Sep 1995 15:22:59 Organization: Sunquest Message-ID: <kitk.1812.000F628E@mudshark.sunquest.com> References: <9a7cb$d1625.8d@news.tcsmgmt.com> <43a4pb$8b4@shellx.best.com> NNTP-Posting-Host: kkauffma.sunquest.com X-Newsreader: Trumpet for Windows [Version 1.0 Rev A]