The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Derek Fawcus <dfawcus+lists-tuhs@employees.org>
To: The Eunuchs Hysterical Society <tuhs@tuhs.org>
Subject: Re: [TUHS] Question about early C behavior.
Date: Fri, 10 Jan 2020 20:55:25 +0000	[thread overview]
Message-ID: <20200110205525.GA1766@clarinet.employees.org> (raw)
In-Reply-To: <CAEoi9W4pONAu4QRKnvQ79pRip5LkqQMq=rXgw4YB5bqYL3XNqQ@mail.gmail.com>

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.

DF

  parent reply	other threads:[~2020-01-10 20:55 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 [this message]
2020-01-10 21:02   ` Warner Losh
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=20200110205525.GA1766@clarinet.employees.org \
    --to=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).