Position of the star in a pointer declaration. Poll

A place for Ogre users to discuss non-Ogre subjects with friends from the community.

Popular position of the star(*) in a pointer declaration

Pointer* variable;
13
48%
Pointer *variable;
10
37%
Pointer * variable;
1
4%
Not important.
3
11%
 
Total votes: 27

User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 538

Re: Position of the star in a pointer declaration. Poll

Post by Kojack »

betajaen wrote:
nikki wrote:vim. :P
You misspelled sublime there Nikki. ;)
Nikki got the first 2 letters right, but the rest of the name should be "sual Studio 2010 Ultimate".
:)


Hmm, that Sublime actually looks pretty cool. Although it's commercial, while my combo of Visual Studio and Notepad++ is free (yay for being a teacher).
User avatar
toglia
Gnome
Posts: 336
Joined: Sat Dec 08, 2007 4:28 am
Location: Canada
x 7

Re: Position of the star in a pointer declaration. Poll

Post by toglia »

Since we're all off topic here, theres something I would like to know.

Every now and then I here people talking about how cool is vim for coding but for me, someone with a visual studio background (now getting used to eclipse), vim looks like stone age. I have just downloaded it, without any cool plugins it must have, but my first impressions were pretty bad. I know every thing is done with the keyboard, and it has a lot of keywords for doing cool stuff, but still most programs have a ton of hotkeys too, I don't get it. So, can somebody explain to me why can somebody replace Vim for Eclipse for example... Does, it have everything Eclipse have? Or is it just for writing code. In that case isn't bad having to switch between applications to get everything one needs?

That sublime mini-map looks awesome, my memory is very visual and I'm sure I would find pieces of code much faster with that! It would be so nice to have it in Eclipse!
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 116

Re: Position of the star in a pointer declaration. Poll

Post by mkultra333 »

I use

int *pName ;

But it's worth noting that my code is a cowboy anti-pattern from the darkest dimensions of Hell.

(Edit: Actually I usually go "int *pName=NULL ;")
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Re: Position of the star in a pointer declaration. Poll

Post by xavier »

Klaim wrote:I don't care.
+1
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58
Contact:

Re: Position of the star in a pointer declaration. Poll

Post by CABAListic »

@toglia: The strength of vim lies in text editing. Unfortunately I've found it somewhat difficult to explain, but the core to its strength is this: Where most standard text editors (including the integrated editor component in Visual Studio) basically focus on text insertion, i.e. whenever you type something, it will be inserted at the current cursor position, vim focusses on manipulation and navigation. vim's 'normal mode' does not let you enter text, instead everything you type will be interpreted as a vim command. If you type e.g. '53G', you will jump to line 53, typing '3d' will delete the next three lines from the cursor's position, etc.. There are several ways to go to the 'insert mode' where you actually insert text; a simple 'i' will start inserting before the cursor's position, 'I' will insert at the beginning of the line. Similar commands exist for inserting at the end or in a new line below or above the current one. Also you can start inserting by replacing existing text. For example, the command 'cib' will delete all text inside a pair of curly braces "(...)" and let you insert something else in there. And so on. It is really very handy, but you have to get used to it, and it takes a while.

One particular strong point that I really miss from many, many text editors is block selection. In vim you can select a block of text (i. e. 10 colums of 5 lines, instead of selecting the whole of the 5 lines), and then even insert something before or after the block which is immediately repeated for all lines in the block. Maybe you have had to do a task similar to this one: Given a list of some tokens (filenames or whatever),

Code: Select all

TOKEN1
TOKEN2
TOKEN3
...
which you copy-pasted from somewhere, and you need to transform then into a function call

Code: Select all

callSomeFunc(TOKEN1);
There is more than one way to do this efficiently in vim, but one way is to select the tokens as a block and insert at the beginning: 'callSomeFunc(', and insert at the end ');', and vim will automatically repeat this for all the tokens in the block.
You can see that in action here: http://www.youtube.com/watch?v=33oelVTGnAU

vim is not perfect, though. It is not a full IDE and even with some of the more advanced plugins it doesn't entirely feel like one, so you do miss out on some cool IDE features. In the end, for me personally I have found that I'm still more productive with vim than with the extra IDE features, but I'm not entirely satisfied. I guess this is why there exist vim plugins for a variety of IDEs; there's one for Visual Studio, but it's commercial. The quality of the plugins varies widely, one supposedly good one exists for netbeans, but I haven't tried that yet.
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Re: Position of the star in a pointer declaration. Poll

Post by xavier »

JustBoo wrote:
xavier wrote:
Klaim wrote:I don't care.
+1
Yeah, I know. I mean, it's all soooo beneath one to even glance and respond to such a silly poll. Someone who doesn't care would not even bother responding? Right? Right, got it.

+1 for the being so droll and "kewl" and junk.
Actually, the point *I* was trying to make is that the original poll makes the same mistake that many do -- no option for "no opinion either way". So, how else can anyone register this choice?
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
User avatar
JaJDoo
Gnome
Posts: 343
Joined: Wed Feb 04, 2009 9:15 pm
x 5

Re: Position of the star in a pointer declaration. Poll

Post by JaJDoo »

xavier wrote: ... the point *I* was trying to make....
i see two stars in your post... that must be an encrypted message
some post from somewhere:
"So you basically want to make a car without a steering wheel because you don't know how to drive. I'd say learn how to use pointers"
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Re: Position of the star in a pointer declaration. Poll

Post by xavier »

JaJDoo wrote:
xavier wrote: ... the point *I* was trying to make....
i see two stars in your post... that must be an encrypted message
I can't tell if you are trying to be an ass, trying to be funny (and failing) or simply picked me as the target of your projected anger today, but whatever the reason, I don't intend to come back to this thread, so if you persist, you'll be talking to yourself.
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Position of the star in a pointer declaration. Poll

Post by jacmoe »

WTF?
Xavier, you should know by now that JaJDoo has a good sense of humour, even though it's twisted. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 538

Re: Position of the star in a pointer declaration. Poll

Post by Kojack »

I guess this is why there exist vim plugins for a variety of IDEs; there's one for Visual Studio, but it's commercial.
VsVim for Visual Studio 2010 is free and open source.
One particular strong point that I really miss from many, many text editors is block selection. In vim you can select a block of text (i. e. 10 colums of 5 lines, instead of selecting the whole of the 5 lines)
Both VS and Notepad++ let you do that using alt+drag mouse or alt+shift+move cursor.
They don't have the insert before/after each line feature you mentioned though. If I was doing what your example did, I'd put in the callSomeFunc(); first, duplicate the line as many times as needed (shift+alt+l to cut a line, then ctrl-v a few times to paste in copies), then block select the tokens, then paste within the brackets of the first callSomeFunc(). VS will past each line of the block into the brackets of the corresponding function.
scratchyrice
Gnome
Posts: 360
Joined: Thu Apr 27, 2006 9:14 pm
Location: United Kingdom - England
x 16

Re: Position of the star in a pointer declaration. Poll

Post by scratchyrice »

I always use

Code: Select all

int * integer;
It just seems more "even" somehow haha

AMD Ryzen 7900x, Gigabyte Nvidia GeForce 3080 10GB, 32GB DDR5

User avatar
JaJDoo
Gnome
Posts: 343
Joined: Wed Feb 04, 2009 9:15 pm
x 5

Re: Position of the star in a pointer declaration. Poll

Post by JaJDoo »

xavier wrote:
JaJDoo wrote:
xavier wrote: ... the point *I* was trying to make....
i see two stars in your post... that must be an encrypted message
I can't tell if you are trying to be an ass, trying to be funny (and failing) or simply picked me as the target of your projected anger today, but whatever the reason, I don't intend to come back to this thread, so if you persist, you'll be talking to yourself.

er... amm... im sorry...?
i was actually trying to ease the previous tension....
some post from somewhere:
"So you basically want to make a car without a steering wheel because you don't know how to drive. I'd say learn how to use pointers"
User avatar
JaJDoo
Gnome
Posts: 343
Joined: Wed Feb 04, 2009 9:15 pm
x 5

Re: Position of the star in a pointer declaration. Poll

Post by JaJDoo »

JustBoo wrote:What tension? I know not this word you speak hu-man. :wink:
that smiley must be hinting something.....
some post from somewhere:
"So you basically want to make a car without a steering wheel because you don't know how to drive. I'd say learn how to use pointers"
User avatar
toglia
Gnome
Posts: 336
Joined: Sat Dec 08, 2007 4:28 am
Location: Canada
x 7

Re: Position of the star in a pointer declaration. Poll

Post by toglia »

Ups! I tried adding the options xavier said but I also restarted the poll... :mrgreen:
Post Reply