[gameprogrammer] Re: A Note on C Programming Style
- From: Robbert de Groot <zekaric@xxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Fri, 6 May 2005 12:09:21 -0400 (EDT)
--- Etali <etali@xxxxxxxxxxxxxx> wrote:
> I'd be interested to hear what other people think and how they
> found it when they were first learning.
My choice of style (char *p camp) was basically inherrited from all
the texts and sample code of the day. High school, Turbo 'C' about
1988ish when I started. Every thing from the Turbo 'C' bible, other
programming literature and sample code on the bbs's did it this way.
Plus almost everything since then till now.
In most books (of the day, maybe the K&R book as well) they cover
'how to read the declaration of a parameter/variable' and the way
they explained how to read it pretty well obligates you to write it
out in the char *p way.
One line per definition? That's a lot of typing. I have one
function in my work code which has about a screen page or two of
variables (yes, large functions do exist and no, breakthing this baby
down isn't really in the cards.)
Plus I generally define variables as such, also one per line but not
as anal.
char *p = NULL,
letter = 'a',
*string = "str",
cat,
dog,
**dolt;
int flag = FALSE,
a,
b,
*ilist;
...
I basically comes down to preference and coding style. No one way is
better than the other. If you've found a way that works for you,
perfect, but it may not be for everyone.
So for me, with the coding style I'm accoustomed to and in my
opinion, the char* p, the definition of one type and var per line,
just feels like handcuffs and has no real benefit in final
readability of the code. 'C'/'C++' is already blasted time and again
for it's requirement to define before use (hence the multitude of
script languages) that you really don't want to make defining
variables any harder than it needs to be.
[All comments should be taking with a grain of salt. It's only my
opinion and style anyway for what it's worth.]
______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- Follow-Ups:
- [gameprogrammer] Re: A Note on C Programming Style
- From: Wes Wannemacher
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: Wes Wannemacher