type* name vs. type *name

S

Sergei Gnezdov

I'd think that

type* pointerName

is more descriptive, than

type *pointerName

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

Peter MacMillan

Sergei said:
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: (e-mail address removed)
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(--)
 
J

Jack Klein

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.
 
K

Keith Thompson

Jack Klein said:
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.
 
G

Gordon Burditt

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top