Uninitialized externals and statics.

T. William Wells bill at twwells.com
Sun Aug 27 05:28:45 AEST 1989


In article <984 at m3.mfci.UUCP> karzes at mfci.UUCP (Tom Karzes) writes:
: In article <1423 at csv.viccol.edu.au> timcc at csv.viccol.edu.au (Tim Cook) writes:
: >In article <1989Aug19.053711.7462 at twwells.com>, bill at twwells.com (T. William Wells) writes:
: >> At one point, we got toasted by some of our customers because our
: >> executables were excessively large. It seems that one of our
: >> programmers did things like:
: >>
: >> int     Array[1000] = {0};
: >
: >Let's not misappropriate blame here.  It seems to me that your compiler
: >should take the blame in this scenario.  Your programmer is simply making
: >sure of what will be in "Array" when the program starts (sounds like a
: >worthwhile programming practice).
:
: Actually, given that the programmer is unwilling to rely on implicit
: zero initialization of statics, he/she is is only making sure that that
: the first element of the array is initialized to 0 in this example.

Actually, the programmer was just following someone's brain-damaged
advice to initialize all globals. He had no idea why one might want
to do so. No, he wasn't a very good programmer. Or even a good coder.

Which reminds me of an answer to the "What makes a C expert" question
that I was going to give but didn't get around to. The "competent C
programmer" knows *what* is valid C. The "C expert" knows *why* it is
valid C; moreover, he is capable of selecting the best C tool for the
job, as opposed to merely using the first thing that comes to mind.

Fundamentally, the difference is that of between knowledge and
judgement.

---
Bill                    { uunet | novavax | ankh | sunvice } !twwells!bill
bill at twwells.com



More information about the Comp.lang.c mailing list