[Freeciv-Dev] Re: Please vote!
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Thu, Nov 29, 2001 at 02:06:31PM +0100, Reinier Post wrote:
> B. There's a difference in meaning for 'static' variables:
>
> | #include <stdio.h>
> |
> | static int x()
> | {
> | static int the_x = 1;
> | return ++the_x;
> | }
> |
> | int main(int argc, char *argv[])
> | {
> | printf("%d\n", x());
> | printf("%d\n", x());
> | printf("%d\n", x());
> | }
>
> prints
>
> 2
> 3
> 4
>
> (It doesn't without the 'static'.)
> It seems clearer to restrict the syntax to static var initializations only.
You mean non-static?
> No preference - I use both. I also use
>
> /* B */
> int foo3b(int x)
> {
> x = 3;
> /* assign 3 to x */
> }
This is IMHO ugly.
> >> /****************************
> >> * 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;
> >> }
>
> A slight preference for A. I wasn't sure if in
>
> | #include <stdio.h>
> |
> | int main(int argc, char *argv[])
> | {
> | char c,d = 65;
> | printf("%c\n", d);
> | }
>
> d would be an int. (It isn't; the program prints 'A'.)
How does this depend on the question 7?
> >> /*************************
> >> * 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);
> >> }
>
> How is this different from case 1?
A uses owner in the second line. So you can't swap the lines anymore.
> Has there been a vote on all the indent(1) options?)
No. And I think we shouldn't do this. This just add more opinions and
we wouldn't come to an end anytime soon.
> /* A */
>
> while (*i++)
> {
> continue;
> }
>
> /* B */
>
> while (*i++)
> {
> }
>
> /* C */
>
> while (*i++) {}
>
> /* D */
>
> while (*i++);
/* E */
while(*i++)
{
/* nothing */ or
/* empty */
}
/* F */
disallow such constructs
My vote: E or maybe also A
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"The Internet is really just a series of bottlenecks
joined by high speed networks."
-- Sam Wilson
- [Freeciv-Dev] Re: Coding Guideline Updated RFC, (continued)
- [Freeciv-Dev] Re: Coding Guideline Updated RFC, Mike Kaufman, 2001/11/27
- [Freeciv-Dev] Please vote!, Gregory Berkolaiko, 2001/11/28
- [Freeciv-Dev] Re: Please vote!, Petrus Viljoen, 2001/11/28
- [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 <=
- [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, 2001/11/28
- [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
|
|