Date: Wed, 15 Oct 1997 13:00:03 +0200 (IST) From: Eli Zaretskii To: Erik Max Francis cc: djgpp AT delorie DOT com Subject: Re: [Q] array declaration In-Reply-To: <3442DDB8.6CC7673E@alcyone.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Mon, 13 Oct 1997, Erik Max Francis 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? It isn't different. But in my experience, functions interface change less (in C programs) than data definitions. > > 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. This might seem like a tiny hole with the toy examples that were posted here. But if your data is a complex struct, having both a declaration and the initialization in the same place helps maintainability, since then a single header file gives a full description of the data type.