[Freeciv-Dev] Re: Voting results for first part of style guide questionn
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Mon, Dec 03, 2001 at 03:18:30PM -0500, vze2zq63@xxxxxxxxxxx wrote:
> Raimar Falke wrote:
>
> > Gregory Berkolaiko has put together the results of the first part of
> > the style guide questionnaire:
>
>
> 10 B or C
> 11B?
> 12A
> 13E
> 14C
>
> > /* A */
> > /* blah
> > blah blah
> > blah */
> > if (x==0)
> > return 1;
> >
> 10A can be reformatted automatically by indent.
Good to know.
> > int foo11(int x)
> > {
> >
> > /* A (always braces) */
> > switch(x) {
> > case 2:
> > {
> > return 2;
> > }
> > case 3:
> > {
> > int d = 5;
> > return d-x;
> > }
> > }
> >
> > /* B (braces where needed) */
> > switch(x+3) {
> > case 2:
> > return 2;
> > case 3:
> > {
> > int d = 5;
> > return d-x;
> > }
> > }
> >
> > /* C (no extra local variables) */
> >
> > {
> > int d;
> > switch(x) {
> > case 2:
> > return 2;
> > case 3:
> > d = 5;
> > retrun d-x;
> > }
> > }
> > }
>
>
> by 11A, do you mean to *always* but braces into *every* switch, or just
> that a switch must have all braces or no braces?
I would assume the former. But I agree that the latter makes more
sense.
> > int foo13(void)
> > {
> >
> > /* A */
> > while (*i++) {
> > continue;
> > }
> >
> > /* B */
> > while (*i++) {
> > }
> >
> > /* C */
> > while (*i++) {}
> >
> > /* D */
> > while (*i++);
> >
> > /* E */
> > while(*i++) {
> > /* nothing */
> > }
> >
> > /* F */
> > /* !disallow such constructs! */
> > }
>
>
> This seems to be getting a bit arbitrary. 13E looks the most legible -
> but such constructs should IMO be avoided except where they're truly
> needed. A bigger question might be between:
>
> for(i=0, j=1; i<=10; i++, j *= 2) {
> /* nothing */
> }
>
> and
>
> j=1;
> for (i=0; i<=10; i++) {
> j *= 2;
> }
Good question indeed. Gregory can you include this question?
> I prefer the latter one
Ack.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"Despite all the medical advances of the 20th century, the mortality
rate remains unchanged at 1 death per person."
- [Freeciv-Dev] Voting results for first part of style guide questionnaire, Raimar Falke, 2001/12/03
- [Freeciv-Dev] Re: Voting results for first part of style guide questionnaire, vze2zq63, 2001/12/03
- [Freeciv-Dev] Re: Voting results for first part of style guide questionnaire,
Raimar Falke <=
- [Freeciv-Dev] Re: Voting results for first part of style guide questionnaire, Petr Baudis, 2001/12/03
- [Freeciv-Dev] Re: Voting results for first part of style guide questionnaire, Stepan Roh, 2001/12/03
- [Freeciv-Dev] Re: Voting results for first part of style guide questionnaire, Greg Wooledge, 2001/12/03
- [Freeciv-Dev] Re: Voting results for first part of style guide questionnaire, Daniel Sjölie, 2001/12/03
- [Freeciv-Dev] Re: Voting results for first part of style guide questionnaire, Julian Rüth, 2001/12/04
- [Freeciv-Dev] Voting results for second part of style guide questionnaire, Gregory Berkolaiko, 2001/12/13
|
|