On Fri, Jan 10, 2020, 1:55 PM Derek Fawcus <dfawcus+lists-tuhs@employees.org> wrote:
On Fri, Jan 10, 2020 at 02:07:53PM -0500, Dan Cross wrote:
>
> My colleague was particularly surprised that this seemed required: even at
> this early stage, the `extern` keyword was present, so why bother with this
> behavior? Why not, instead, make it a link-time error? Please note that if
> two source files have initializers for these variables, then one gets a
> multiple-definition link error. The 1988 ANSI standard made this an error
> (or at least undefined behavior) but the functionality persists; GCC is
> changing its default to prohibit it (my colleague works on clang).

This behaviour differed between platforms, unix using the common approach,
and some other platforms simplying making it a (non common) symbol in the bss.

Having learnt C in its pre-ANSI form on unix, I then ran in to this behaviour
on DOS C compilers.  None of which (that I came across) providing the 'common'
behaviour.

Gcc offered warnings for this behavior in the early 90s, iirc. I went through a bunch of code in that time frame to remove the assumption...

Warner