🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #35756

Re: MWC/CSD bug?

#35756
From: Allan Pratt
Date: Wed, 04 Jan 1989 20:22
25 lines
1640 bytes
In article <5440009@hplsla.HP.COM> andyc@hplsla.HP.COM (Andy Cassino) writes:
> I'm having trouble with the -VCSD option in Mark Williams C, version 3.05.

> foo.h - local include file that defines global variable "foo"
> mod1.c - source module which #includes foo.h
> main.c - another source module which #includes foo.h

This is not strictly legal.  K&R section 11.2, on p. 206 (near the bottom):

	"[I]n a multi-file program, an external data definition without the
	'extern' specifier must appear in exactly one of the files.  Any other
	files which wish to give an external definition for the identifier
	must include the 'extern' in the definition."

Many compilers allow what you have done, and ANSI recognizes the "common
extension" that "int foo;" may appear in many source files and all refer
to the same storage, but strict ANSI C follows the quotation above. 

(In fact, the .common directive of most assemblers is what takes care of
this situation: the linker ultimately resolves all these declarations to
refer to the same storage.)

============================================
Opinions expressed above do not necessarily	-- Allan Pratt, Atari Corp.
reflect those of Atari Corp. or anyone else.	  ...ames!atari!apratt
Technical Details
Message-ID: <1289@atari.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!seismo!sundc!pitstop!sun!imagen!atari!apratt
References: <5440009@hplsla.HP.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!seismo!sundc!pitstop!sun!imagen!atari!apratt
From: apratt@atari.UUCP (Allan Pratt)
Newsgroups: comp.sys.atari.st
Subject: Re: MWC/CSD bug?
Message-ID: <1289@atari.UUCP>
Date: 4 Jan 89 20:22:15 GMT
References: <5440009@hplsla.HP.COM>
Reply-To: apratt@atari.UUCP (Allan Pratt)
Organization: Atari (US) Corporation, Sunnyvale, California
Lines: 25