From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id cee873ec for ; Fri, 10 Jan 2020 20:55:41 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id 400849B7F7; Sat, 11 Jan 2020 06:55:40 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 6A53393D85; Sat, 11 Jan 2020 06:55:28 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id 55A2993D85; Sat, 11 Jan 2020 06:55:26 +1000 (AEST) Received: from clarinet.employees.org (clarinet.employees.org [198.137.202.74]) by minnie.tuhs.org (Postfix) with ESMTPS id 18DED93D07 for ; Sat, 11 Jan 2020 06:55:26 +1000 (AEST) Received: by clarinet.employees.org (Postfix, from userid 1736) id 92B014E11D8A; Fri, 10 Jan 2020 20:55:25 +0000 (UTC) Date: Fri, 10 Jan 2020 20:55:25 +0000 From: Derek Fawcus To: The Eunuchs Hysterical Society Message-ID: <20200110205525.GA1766@clarinet.employees.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [TUHS] Question about early C behavior. X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" 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