www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/04/21:00:53

Xref: news2.mv.net comp.os.msdos.djgpp:8273
From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Declaring global arrays in a multisource project
Date: Wed, 04 Sep 1996 19:07:21 -0700
Organization: Three pounds of chaos and a pinch of salt
Lines: 25
Message-ID: <322E35D9.5291@cs.com>
References: <01I937U2638O00D67E AT cc DOT uab DOT es>
NNTP-Posting-Host: ppp211.cs.com
Mime-Version: 1.0
To: "x DOT pons AT cc DOT uab DOT es" <ILGES AT cc DOT uab DOT es>
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

x DOT pons AT cc DOT uab DOT es wrote:
> 
> Dear programmers,
> 
> In a multi-source project I have a global array, declared as:
> 
>   char my_global_array[256];
> 
> in one of the modules.
> 
> Which is the best way of declaring it on the other modules?
> 
>   extern char my_global_array[256];      <<----
>   extern char *my_global_array;
>   extern char my_global_array[];

You should always define extern variables in _exactly_ the same way you
define them in the 'home' module.  Anything else could get you into trouble.

-- 
--------------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I    |         fighteer AT cs DOT com           |
| Plan:  To find ANYONE willing to   |    http://www.cs.com/fighteer     |
| play Descent 2 on DWANGO!          |  Tagline: <this space for rent>   |
--------------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019