[Freeciv-Dev] Coding Guideline --- more variants
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To better reflect varying opinions of the voters I included another
possible choice in question 7 and added question 9 (very much related to
3).
Shall we set a vague deadline on the voting? Say this weekend?
================ Cut here. Fill in blue ink only =====================
/***************
* 1: init vars
***************/
/* A */
int foo1a(struct city *punit)
{
int x = punit->x;
}
/* B */
int foo1b(struct city *punit)
{
int x;
x = punit->x;
}
/**************************
* 2: empty line after vars
**************************/
/* A */
int foo2a(void)
{
int x;
x = 3;
}
/* B */
int foo2b(void)
{
int x;
x = 3;
}
/***********************************
* 3: comments in code (see also 9:)
***********************************/
/* A */
int foo3a(int x)
{
x = 3; /* assign 3 to x */
}
/* B */
int foo3b(int x)
{
/* assign 3 to x */
x = 3;
}
/**************************
* 4: extra {} on iterates
**************************/
int foo4(struct city *pcity)
{
/* A */
unit_list_iterate(pcity->units_supported, punit) {
kill(punit);
} unit_list_iterate_end;
/* B */
unit_list_iterate(pcity->units_supported, punit)
kill(punit);
unit_list_iterate_end;
}
/******************************************
* 5: unnecessary braces after conditionals
******************************************/
int foo5(int x)
{
/* A */
if (x == 3) {
return;
}
/* B */
if (x == 4)
return;
}
/****************************************************
* 6: unnecessary braces after conditionals with else
****************************************************/
int foo6(int x)
{
/* A */
if (x == 3) {
return 1;
} else {
return 0;
}
/* B */
if (x == 4)
return 1;
else
return 0;
}
/****************************
* 7: merge declaration lines
****************************/
/* A */
int foo7a(struct city *pcity)
{
int total, cost;
int build = pcity->shield_stock;
}
/* B */
int foo7b(struct city *pcity)
{
int total, cost, build = pcity->shield_stock;
}
/* C (one line per declaration) */
int foo7a(struct city *pcity)
{
int total;
int cost;
int build = pcity->shield_stock;
}
/*************************
* 8: double dereferencing
*************************/
/* A */
int foo8a(struct city *pcity)
{
struct player *owner = city_owner(pcity);
struct nation_type *nation = get_nation_by_plr(owner);
}
/* B */
int foo8b(struct city *pcity)
{
struct player *owner = city_owner(pcity);
struct nation_type *nation;
nation = get_nation_by_plr(owner);
}
/*****************************
* 9: comments in declarations
*****************************/
int foo9(void)
{
/* A */
struct foo {
int bar; /* bar is used for ....
* in ..... way */
int blah; /* blah is used for .... */
};
/* B */
struct foo {
/* bar is used for ....
* in ..... way */
int bar;
/* blah is used for .... */
int blah;
};
}
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and
Music Charts
http://uk.my.yahoo.com
- [Freeciv-Dev] Re: Please vote!, (continued)
- [Freeciv-Dev] Re: Please vote!, Stepan Roh, 2001/11/28
- [Freeciv-Dev] Re: Please vote!, vze2zq63, 2001/11/28
- [Freeciv-Dev] Re: Please vote!, Reinier Post, 2001/11/29
- [Freeciv-Dev] Re: Please vote!, Raimar Falke, 2001/11/29
- [Freeciv-Dev] Re: Please vote!, Reinier Post, 2001/11/29
- [Freeciv-Dev] Re: Please vote!, Petr Baudis, 2001/11/29
- [Freeciv-Dev] Re: Please vote!, Reinier Post, 2001/11/29
- [Freeciv-Dev] Re: Please vote!, Gregor Zeitlinger, 2001/11/30
- [Freeciv-Dev] Re: Please vote!, Vasco Alexandre Da Silva Costa, 2001/11/29
- [Freeciv-Dev] Re: Please vote!, Ross W. Wetmore, 2001/11/30
- [Freeciv-Dev] Coding Guideline --- more variants,
Gregory Berkolaiko <=
- [Freeciv-Dev] Re: Coding Guideline --- more variants, Raimar Falke, 2001/11/28
- [Freeciv-Dev] Re: Coding Guideline --- more variants, Raimar Falke, 2001/11/28
- [Freeciv-Dev] Re: Coding Guideline --- more variants, Petr Baudis, 2001/11/28
- [Freeciv-Dev] Re: Coding Guideline --- more variants, Raahul Kumar, 2001/11/29
- [Freeciv-Dev] Re: Coding Guideline --- more variants, Petr Baudis, 2001/11/29
- [Freeciv-Dev] Re: Coding Guideline --- more variants, Reinier Post, 2001/11/29
- [Freeciv-Dev] Re: Coding Guideline --- more variants, Raimar Falke, 2001/11/29
- [Freeciv-Dev] Re: Coding Guideline --- more variants, Reinier Post, 2001/11/29
- [Freeciv-Dev] Re: Coding Guideline --- more variants, Daniel L Speyer, 2001/11/28
- [Freeciv-Dev] Re: Coding Guideline --- more variants, Raahul Kumar, 2001/11/29
|
|