From owner-freebsd-hackers Mon Jul 3 13:44:11 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.40.131]) by hub.freebsd.org (Postfix) with ESMTP id 9B67537B602 for ; Mon, 3 Jul 2000 13:44:07 -0700 (PDT) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.9.3/8.9.3) with ESMTP id WAA08741; Mon, 3 Jul 2000 22:43:10 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) To: David Malone Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Global variables defined several times. In-reply-to: Your message of "Mon, 03 Jul 2000 21:40:21 BST." <200007032140.aa37554@salmon.maths.tcd.ie> Date: Mon, 03 Jul 2000 22:43:10 +0200 Message-ID: <8739.962656990@critter.freebsd.dk> From: Poul-Henning Kamp Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message <200007032140.aa37554@salmon.maths.tcd.ie>, David Malone writes: >I've just noticed that usr.bin/ftp/ftp_var.h defines a large >selection of global variables, and then this header file is included >in multiple C source files. > >I thought this should lead to one copy of the global varible per >source file, and then a warning or error at link time due to symbols >being defined multiple times. This doesn't seem to be the case with >the toolchain - you seem to get one copy of each variable for the >final linked unit. This is called "common" variables. They're documented with that behaviour in the old and new testament. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD coreteam member | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message