Mail Archives: djgpp/1997/10/15/07:01:19
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.
- Raw text -