[Freeciv-Dev] Re: PATCH: AI cleanup Version 2
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
> If we do so we have to have:
> - to do it for all code
yes, we just have to start somewhere :-)
> - guidelines first
yes
>
> Doing it at some part of the code based on your personal idea of how
> does it look nice is not ok. We all have personal idea of how does the
> code have to look but have to formalize this before we go to change
> this. I really hope we can get a discussion going which will produce
> such guidelines. Here are some questions for the start:
>
> * init vars
> int foo(struct city *punit)
> {
> int x=punit->x;
> }
> or
> int foo(struct city *punit)
> {
> int x;
>
> x=punit->x;
> }
I think the second will be better, it's more clear.
> * empty line after vars
> int x;
> x=3;
> or
> int x;
>
> x=3;
Empty line, absolutely.
> * comments
> x=3; /* assign 3 to x */
> or
> /* assign 3 to x */
> x=3;
I prefer first, unless the command or comment will be really long, or unless we
will describe larger part of code obviously.
> * extra {} on iterates
It would be good. At least to help editors to autoindent them etc. And for
clarity too.
* spaces around assignment
x=3;
or
x = 3;
I would prefer the second one.
* spaces around conditionals
if(x == 3){
or
if( x == 3 ){
or
if (x == 3) {
Third one seems best to me.
* spaces around delimiters
a(b,c);
for (b=0;b<c;b++)
or
a(b, c);
for (b = 0; b < c; b++)
I vote for the second one.
I like this, it looks we will at last be able to get into sync and i will be
able to produce patches which you will be willing accept :-). And the code
will be readable enough to optimize it etc.
--
Petr "Pasky" Baudis
UN*X programmer, UN*X administrator, hobbies = IPv6, IRC
Real Users hate Real Programmers.
Public PGP key, geekcode and stuff: http://pasky.ji.cz/~pasky/
- [Freeciv-Dev] PATCH: AI cleanup Version 2, (continued)
- [Freeciv-Dev] PATCH: AI cleanup Version 2, Raahul Kumar, 2001/11/23
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Petr Baudis, 2001/11/23
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Raimar Falke, 2001/11/23
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Petr Baudis, 2001/11/23
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Raahul Kumar, 2001/11/23
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Raimar Falke, 2001/11/24
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Petr Baudis, 2001/11/24
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Raimar Falke, 2001/11/24
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Petr Baudis, 2001/11/24
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Raimar Falke, 2001/11/25
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2,
Petr Baudis <=
- [Freeciv-Dev] Coding Guideline, Gregor Zeitlinger, 2001/11/25
- [Freeciv-Dev] Coding Guideline RFC, Gregory Berkolaiko, 2001/11/25
- [Freeciv-Dev] Re: Coding Guideline RFC, Greg Wooledge, 2001/11/25
- [Freeciv-Dev] Re: Coding Guideline RFC, Daniel Sjölie, 2001/11/25
- [Freeciv-Dev] Re: Coding Guideline RFC, Raimar Falke, 2001/11/26
- [Freeciv-Dev] Re: Coding Guideline RFC, Raimar Falke, 2001/11/26
- [Freeciv-Dev] Re: Coding Guideline RFC, Petr Baudis, 2001/11/26
- [Freeciv-Dev] Coding Guideline Updated RFC, Gregory Berkolaiko, 2001/11/26
- [Freeciv-Dev] Re: Coding Guideline Updated RFC, Gregory Berkolaiko, 2001/11/26
- [Freeciv-Dev] Re: Coding Guideline Updated RFC, Andrew Sutton, 2001/11/26
|
|