delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/14/07:46:27

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: [Q] array declaration
Date: Mon, 13 Oct 1997 19:49:28 -0700
Organization: Alcyone Systems
Lines: 26
Message-ID: <3442DDB8.6CC7673E@alcyone.com>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 971012142438 DOT 8447S-100000 AT is>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Eli Zaretskii wrote:

> This solves the problem with the size, but it still requires you to
> put the type of the variable in two different places.  What if one day
> you decide to make `myarray' int or long or an array of structs?

But how is this model any different than for functions?  If you want to
change the parameters or return type for a function, you have to change
it in the function definition as well as its declaration (i.e.,
prototype).

Same thing with externals.  If you want to change the definition, you
have to change the "prototype" -- that is, the declaration.

> You put this into a header, then in one, and only one, source file
> say "#define DEFINE_VARS".  This is ugly, but it works.

Agh.  This is like patching a tiny little hole by blowing up the dam.

-- 
          Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
                        Alcyone Systems / http://newton.alcyone.com/
   San Jose, California, United States / icbm://+37.20.07/-121.53.38
                                      \
   "After each war there is a little / less democracy to save."
                                    / Brooks Atkinson

- Raw text -


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