Complete.Org: Mailing Lists: Archives: freeciv-ai: July 2004:
[freeciv-ai] (PR#7342) cm patch: heap-allocate the combinations
Home

[freeciv-ai] (PR#7342) cm patch: heap-allocate the combinations

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: bh@xxxxxxxxxxxxxxxxxxx
Subject: [freeciv-ai] (PR#7342) cm patch: heap-allocate the combinations
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 23 Jul 2004 20:47:38 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7342 >

A note on style:

- Put spaces in between just about all elements, even when it makes
things uglier.  E.g., do x[i - 1] rather than x[i-1].

- Use x++ instead of ++x in situations where it doesn't matter (just for
consistency).

- Don't cast the result of alloc calls.  E.g.

  int *x = malloc(sizeof(*x));

rather than

  int *x = (int *)malloc(sizeof(int));

- Use variables instead of types in sizeof calls wherever possible.  In
most cases this is more robust since the type's name may change.  (See
the last example).

Hmm, that's probably it.  (Perhaps some of this isn't just style but is
actually technical.  But I think it's all in the docs somewhere.)

jason



[Prev in Thread] Current Thread [Next in Thread]