[gameprogrammer] Re: A Note on C Programming Style
- From: Wes Wannemacher <techgeek@xxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Thu, 5 May 2005 16:32:37 -0400
On 5/5/05, Chris Nystrom <cnystrom@xxxxxxxxx> wrote:
> Hi,
>=20
> Here is a small rant on C programming style from my blog, that some
> beginners might find useful:
>=20
[snip]
>=20
> For this reason, I believe it would be better to write pointer definition=
s:
>=20
> char* p;
>=20
> Note that the space is now between the * and the pointer name, and
> also that the change has no effect on the code itself.
>=20
[/snip]
Although you make a valid point here, there is one thing that I think
needs to be noted about this type of notation... It can be misleading
if you are declaring multiple variables. For instance:
char* p, q;
Would mean, one pointer of type char and one char variable. I know
that it would be bad style to declare these two as such, but when you
put the * close to the type, I can see it leading to this type of
error later. That's normally why I put the * by the variable name
rather than the variable type.
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- Follow-Ups:
- [gameprogrammer] Re: A Note on C Programming Style
- From: Alan Wolfe
- References:
- [gameprogrammer] A Note on C Programming Style
- From: Chris Nystrom
Other related posts:
- » [gameprogrammer] A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- » [gameprogrammer] Re: A Note on C Programming Style
- [gameprogrammer] Re: A Note on C Programming Style
- From: Alan Wolfe
- [gameprogrammer] A Note on C Programming Style
- From: Chris Nystrom