Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!mcnc!gatech!bloom-beacon!think!ames!lll-lcc!unisoft!hoptoad!rtech!llama!wong From: wong@llama.rtech.UUCP (J. Wong) Newsgroups: comp.lang.c Subject: Re: portability and standards Message-ID: <1057@rtech.UUCP> Date: Fri, 10-Jul-87 14:21:35 EDT Article-I.D.: rtech.1057 Posted: Fri Jul 10 14:21:35 1987 Date-Received: Sun, 12-Jul-87 15:51:29 EDT References: <8113@brl-adm.ARPA> Sender: news@rtech.UUCP Reply-To: wong@llama.UUCP (J. Wong) Organization: Relational Technology, Inc. Alameda, CA Lines: 28 In article <8113@brl-adm.ARPA> edstrom%UNCAEDU.BITNET@wiscvm.wisc.EDU writes: >I don't understand the need for macros in defining and initializing global >variables. Maybe I am missing the point but what I do for header files with >variables shared by many .c modules is: > >headerfile.h > >extern double example; >double example = 33.3; > >I use this on VAX VMS and it works fine. Is ther some reason why this approach >is not "safe" or "proper"? > Although this is "safe" and "proper", it is not space efficient. The DEC C implementation allocates all global variables separately, each in a separate PSECT. Since a PSECT is a page, this results in a lot of wasted space. In addition, if you happen to have a declaration that is not used, it still forces the definition to be linked into the image. Better to use globalref/globaldef with DEC C (see the manual.) Of course, this is not portable ... (unless you use defines of some sort.) J. Wong ucbvax!mtxinu!rtech!wong **************************************************************** You start a conversation, you can't even finish it. You're talking alot, but you're not saying anything. When I have nothing to say, my lips are sealed. Say something once, why say it again. - David Byrne