how do you make your pointers?

Started by
45 comments, last by flucknugget 22 years, 1 month ago
1) type* name; 2) type *name; 3) type * name; i use #1, i personally think it makes the most sense, since the pointer is kind of part of the type. int* myint would be a pointer to an int. i''m just really curious, how do you guys do it? - f l u c k y p o o - the geek inside
- f l u c k y p o o
Advertisement
I the second method

"I bow to know one and give service only to cause"
"I bow to know one and give service only to cause"
first method

No, HTML is not an OO language.
2nd method


University is a fountain of knowledge, and students go there to drink.
quote:Original post by flucknugget
1) type* name;
2) type *name;
3) type * name;

i use #1, i personally think it makes the most sense, since the pointer is kind of part of the type.


Disagree, *name shows that name is a pointer because it is connected to the variable in my opinion. I see your point, but when you declare several variables like:


    int var1, var2, var3;int *var1, *var2, *var3;  


How would you declare this according to your method?


    int* var1, * var2, *var3; ??or you always do:int* var1;int* var2;int* var3;    


Just my humble point of view.


[edited by - clabinsky on March 20, 2002 11:44:52 PM]
Why make it simple when you can make it sooo nice and complicated?
#1 all the way. As flucknugget said, the ''pointer'' qualifier is part of the variable''s type, not the variable''s name.

I find #2 to be misleading. It gives the appearance of dereferencing the pointer:
int *i = &p
but what''s really happening is
i = &p
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
no clabinsky, you can just do this:

int* var1, var2, var3;

they would all be pointers. I prefer method one also, because of this. Also in my head when I read this I read "integer pointer called var1" not "var1 is a pointer to an integer"

just the way I like it I guess

-Pac
-Pac "The thing I like about friends in my classes is that they can't access my private members directly." "When listening to some one tell about their problem (whether it's code or not), don't listen to what went right or wrong, but what they assumed....."
What''s wrong with:

int* var1, var2, var3;
2nd method. You 1st method guys are all crazy
quote:Original post by Pactuul
they would all be pointers

Actually, only the first one would be a pointer.
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers

This topic is closed to new replies.

Advertisement