指针表示:风格还是实质? [英] pointer representation: style or substance?

查看:48
本文介绍了指针表示:风格还是实质?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

之间有什么区别:


char *指针;

char *指针;


是美学的选择还是这表示真正的差异?


Zach

Is there any difference between:

char *pointer;
char* pointer;

Is the choice one of aesthetics or does this denote real differences?

Zach

推荐答案

2月19日下午1:06,Zach < net ... @ gmail.comwrote:
On Feb 19, 1:06 pm, "Zach" <net...@gmail.comwrote:

之间有什么区别:


char * pointer;

char *指针;


是选择美学还是这表示真正的差异?
Is there any difference between:

char *pointer;
char* pointer;

Is the choice one of aesthetics or does this denote real differences?



没有真正的区别;选择只是美学之一。


然而,

char *指针;

会误导新手,在那

char * pointer1,pointer2;

可能被误读为

pointer1是指向char的指针

pointer2是一个指向char的指针

而不是

pointer1是指向char的指针

pointer2是一个字母


恕我直言,

char *指针;

更清晰(对于初学者),因为

误读的可能性较小

char * pointer1,pointer2;

如上所述。


HTH

-

Lew

No real difference; the choice is one of aesthetics only.

However,
char* pointer;
can mislead a neophyte, in that
char* pointer1, pointer2;
may be mis-read as
pointer1 is a pointer to char
pointer2 is a pointer to char
rather than
pointer1 is a pointer to char
pointer2 is a char

IMHO,
char *pointer;
is clearer (to the neophyte), in that there is less chance of
misreading
char *pointer1, pointer2;
as above.

HTH
--
Lew


2月19日下午1:13,Lew Pitcher < lpitc ... @ sympatico.cawrote:
On Feb 19, 1:13 pm, "Lew Pitcher" <lpitc...@sympatico.cawrote:

>

没有真正的区别;选择只是一种美学。
>
No real difference; the choice is one of aesthetics only.



谢谢Lew。


Zach

Thanks Lew.

Zach




" Zach" < ne **** @ gmail.com写信息

news:11 ********************* @ v45g2000cwv.googlegro ups .com ...

"Zach" <ne****@gmail.comwrote in message
news:11*********************@v45g2000cwv.googlegro ups.com...

之间有什么区别:


char *指针;

char *指针;


选择美学之一还是这表示真正的差异?
Is there any difference between:

char *pointer;
char* pointer;

Is the choice one of aesthetics or does this denote real differences?



没有区别;这只是个人风格的问题。

然而,第二种风格可能会产生误导,特别是对于新的

程序员:


char * ptr1,ptr2;


这里,ptr1是一个指向char的指针,但是ptr1只是一个char。


char * x ,y;

以上样式更清楚x是指针但y不是。


-

Fred L. Kleinschmidt

There is no difference; it is just a matter of personal style.
However, the second style can be misleading, especially to new
programmers:

char* ptr1, ptr2;

Here, ptr1 is a pointer to char, but ptr1 is just a char.

char *x, y;
The above style makes it more clear that x is a pointer but y is not.

--
Fred L. Kleinschmidt


这篇关于指针表示:风格还是实质?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆