The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Warner Losh <imp@bsdimp.com>
To: Derek Fawcus <dfawcus+lists-tuhs@employees.org>
Cc: The Eunuchs Hysterical Society <tuhs@tuhs.org>
Subject: Re: [TUHS] Question about early C behavior.
Date: Fri, 10 Jan 2020 14:02:33 -0700	[thread overview]
Message-ID: <CANCZdfo407L-Fwf7W1HVaPPekq5d-Yxr03zUqMrUEkoErwx42w@mail.gmail.com> (raw)
In-Reply-To: <20200110205525.GA1766@clarinet.employees.org>

[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]

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

>

[-- Attachment #2: Type: text/html, Size: 1813 bytes --]

  reply	other threads:[~2020-01-10 21:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-10 19:07 Dan Cross
2020-01-10 20:24 ` Paul Winalski
2020-01-10 20:55 ` Derek Fawcus
2020-01-10 21:02   ` Warner Losh [this message]
2020-01-10 21:05 ` Clem Cole

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANCZdfo407L-Fwf7W1HVaPPekq5d-Yxr03zUqMrUEkoErwx42w@mail.gmail.com \
    --to=imp@bsdimp.com \
    --cc=dfawcus+lists-tuhs@employees.org \
    --cc=tuhs@tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).