[Python-Dev] static int debug = 0;

Jeremy Hylton jeremy@beopen.com
Thu, 31 Aug 2000 22:40:25 -0400 (EDT)

Quick note on BDFL-approved style for C code.

I recently changed a line in gcmodule.c from
static int debug;
static int debug = 0;

The change is redundant, as several people pointed out, because the C
std requires debug to be initialized to 0.  I didn't realize this.
Inadvertently, however, I made the right change.  The preferred style
is to be explicit about initialization if other code depends on or
assumes that it is initialized to a particular value -- even if that
value is 0.

If the code is guaranteed to do an assignment of its own before the
first use, it's okay to omit the initialization with the decl.