how do you make your pointers?

Started by
45 comments, last by flucknugget 22 years, 1 month ago
All this pointing is making me dizzy! :-S



bangz.
Advertisement
I say just typecast it! That way it doesn''t matter which way you declare it.

typecast int* ptrINT;

ptrINT ptr_v, ptr_y, p;


Problem solved. Order has been restored once again.

Dino M. Gambone
Good judgment is gained through experience. Experience, however, is gained through bad judgment.

Currently working on Rise of Praxis MUD: http://www.riseofpraxis.net/

quote:Original post by Dino
I say just typecast it! That way it doesn''t matter which way you declare it.

I think you mean typedef.
DOH!

Dino M. Gambone
Good judgment is gained through experience. Experience, however, is gained through bad judgment.

Currently working on Rise of Praxis MUD: http://www.riseofpraxis.net/

quote:Original post by Anonymous Poster

I tend not to use const.. as I know whether or not I want it changed or not (and it''s ussually pretty obvious) and I''m pretty much the only one that see''s my code :D.


const correctness is a good habit to get into. Apart from the obvious issue of making your code usable for other people (which may not be an issue now, but may be later in your career) the compiler can make certain optimizations with const variables, leading to faster code.

typedef int * pint;

pint ptr1, ptr2, ptr3; :p
I don''t know about you guys, but I like to do it like this:

  int                                     *            int_ptr;  



The point is this: the compiler doesn''t give a fiddler''s damn, and the rest is just personal preference. So, please, Mr. moderator, close this stupid thread.

This topic is closed to new replies.

Advertisement