473,395 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

type* name vs. type *name

I'd think that

type* pointerName

is more descriptive, than

type *pointerName

After all, we define a type pointer, not the pointer by itself.
Nov 14 '05 #1
5 1076
Sergei Gnezdov wrote:
I'd think that

type* pointerName

is more descriptive, than

type *pointerName

After all, we define a type pointer, not the pointer by itself.


You might want to take a look at:
http://www.research.att.com/~bs/bs_faq2.html#whitespace

Which certainly aggrees that type* name is preferable to type *name -
but it ultimatly comes down to preference as both are valid.

--
Peter MacMillan
e-mail/msn: pe***@writeopen.com
icq: 1-874-927

GCS/IT/L d-(-)>-pu s():(-) a- C+++(++++)>$ UL>$ P++ L+ E-(-) W++(+++)>$
N o w++>$ O !M- V PS PE Y+ t++ 5 X R* tv- b++(+) DI D+(++)>$ G e++ h r--
y(--)
Nov 14 '05 #2
In article <Av********************@rogers.com>,
Peter MacMillan <pe***@writeopen.com> wrote:
....
You might want to take a look at:
http://www.research.att.com/~bs/bs_faq2.html#whitespace

Which certainly aggrees that type* name is preferable to type *name -
but it ultimatly comes down to preference as both are valid.


The problem with: type* name;
is that you might be confused by: type* name1,name2;

Nov 14 '05 #3
On 29 Mar 2005 04:00:17 GMT, Sergei Gnezdov <us**********@gnezdov.net>
wrote in comp.lang.c:
I'd think that

type* pointerName

is more descriptive, than

type *pointerName

After all, we define a type pointer, not the pointer by itself.


Why should we care what you think? What qualifications do you have
that we should give weight to your opinion?

The original C style came from Dennis Ritchie's decision several
decades ago that declaration syntax should imitate use.

Given:

int *ip;

....then given proper initialization, the expression:

*ip

....is indeed an int.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #4
Jack Klein <ja*******@spamcop.net> writes:
On 29 Mar 2005 04:00:17 GMT, Sergei Gnezdov <us**********@gnezdov.net>
wrote in comp.lang.c:
I'd think that

type* pointerName

is more descriptive, than

type *pointerName

After all, we define a type pointer, not the pointer by itself.
Why should we care what you think? What qualifications do you have
that we should give weight to your opinion?


Isn't that a bit harsh? C's declaration syntax, and the conventions
that go with it, are pretty counterintuitive until you understand the
reasoning behind them.
The original C style came from Dennis Ritchie's decision several
decades ago that declaration syntax should imitate use.

Given:

int *ip;

...then given proper initialization, the expression:

*ip

...is indeed an int.


Agreed. Your followup would have been a good one with that one
paragraph deleted.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #5
>I'd think that
type* pointerName
is more descriptive, than
type *pointerName
After all, we define a type pointer, not the pointer by itself.


This works until you try to declare more than one of them in
the same declaration.

type* p1, p2;

It looks like p1 and p2 are the same type, doesn't it? They're
not. Now the form you think is more descriptive is more misleading.

Gordon L. Burditt
Nov 14 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: chobin | last post by:
Hi all. I've a terrible question. I've to build one XML page (based on a xml schema) that implements a dynamic database. In particular, I would declare something like this: <?xml version="1.0"...
3
by: dgaucher | last post by:
Hi, I want to consume a Web Service that returns a choice, but my C++ client always receives the same returned type. On the other hand, when I am using a Java client, it is working fine (of...
2
by: Jason Cartwright | last post by:
I have an abstract base class and two derived classes that I want to serialize and deserialize with schema validation. When I serialize instances of the derived classes the XmlSerializer adds the...
1
by: Marc | last post by:
Hi! I'm working with a C# client that calls a php web service. I've created a wrapper to call the service using .NET wsdl tool (adding a web reference). The call to the server works fine, it...
0
by: Chris Fink | last post by:
When I am consuming a webservice, an object has an undefined value (inq3Type.Call3Data). I do not completely understand why this is happening and apologize for the vague question. My assumption...
0
by: Jigar.Patel | last post by:
I have simple remoting server exposing following simple method. When I try to add webreference to this server in another project, it gives me following error: Custom tool error: Unable to import...
6
by: RickH | last post by:
Hello, I would like to create a user XSD data type that inherits from the w3 standard data type called ID to make sure a certain repeated element always contains distinct values. The problem is...
5
by: mknoll217 | last post by:
I am a newbie at XML. I have been given an xml document that I need to write the schema for, for a class assignment. The xml given to me is <?xml version="1.0"?> <Vendors> <Vendor> ...
8
omerbutt
by: omerbutt | last post by:
hi there i have a form with multiple input (type/text ) fields and three inputs(type/file) fields i have to submit the form via ajax because i have multiple forms on this page ,you can say it is a...
7
vikas251074
by: vikas251074 | last post by:
I am getting error above in following code since few days giving tension day and night. How can I solve this? I am facing since Oct.25. in line no. 362 After doing a lot of homework, I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.