Whitesmith and static variable init.

tom at rlgvax.UUCP tom at rlgvax.UUCP
Sat Jul 23 08:20:30 AEST 1983


I can't buy the arguments that Whitesmith compilers force explicit declarations
in all external definitions because some linkers don't support "bss space"
(space that is "stored" in the object module only by a mention of how
long it is -- once a loader loads the program it is supposed to allocate
that much space and zero it out).

If you can't use "bss space", don't!!
Just build into the compiler that any external definition not explicitly
initialized is implicitly initialized to 0.  On machines that support
"bss", set up the "bss" space in your compiler output.  On machines that
don't, simply include these with your initialized variables, except that
they happen to be initialized to 0.  Use of a "bss" feature is independent
of the input language.  Why do you thionk they call it "high level" ...

My guess is that Whitesmith's found it difficult and/or inconvenient
to implement C's initialization syntax.  One reason may be that originally,
C did not use a "=" between the variable name and the initialized value,
so constructs like "int x 5;" were allowed.  This got pretty difficult
to implement when fancier initializations were allowed (things like
structure initialization got added), so Bell Labs added the "=" to make
life easier.  Whitesmith's perhaps got caught before or during the change.

Another reason may be that they share quite a few components between
compilers of different languages, and doing proper C initialization was
difficult to do with their tools and components.  So they decided to
change the product instead of sharpening the tools.

If anyone knows the real reason I'd be interested to know ...
- Tom Beres
{sesimo, allegra, , mcnc, brl-bmd}!rlgvax!tom



More information about the Comp.lang.c mailing list