Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!ll-xn!mit-eddie!mit-amt!mit-caf!vlcek
From: vlcek@mit-caf.MIT.EDU (Jim Vlcek)
Newsgroups: comp.lang.c
Subject: .header(ing) them off at the pass
Summary: I ?? Lack discipline ?!?
Message-ID: <1076@mit-caf.MIT.EDU>
Date: 7 Jul 88 01:33:40 GMT
References: <28400001@ntvax> <6104@sigi.Colorado.EDU> <2955@ihlpe.ATT.COM> <1021@mit-caf.UUCP> <1002@ficc.UUCP>
Reply-To: vlcek@mit-caf.UUCP (Jim Vlcek)
Organization: Microsystems Technology Laboratories, MIT
Lines: 40

In article <1002@ficc.UUCP> peter@ficc.UUCP (Peter da Silva) wonders
what the heck I'm talking about:

>> If one changes/deletes a variable in an #include file, one must
>> comb through every source file using that #include file and
>> change/delete every reference to that variable.
>
>If one deletes a global variable, one must comb through every source
>file that might be using that variable anyway. If one changes a variable,
>that's still true. Whether or not that variable is declared in an include
>file (for example, _ctype in ctype.h) or not. The same is true when you
>change an element of a structure declared in an include file.
>
>I don't understand this objection at all.

What I was saying was:  People are pointing out that putting
initializations in the .header file eliminates one variable
declaration/definition.  Hence, should one make a change or delete
such a variable, there will be one less change/deletion to make.  I
pointed out that this (one) extra change/deletion would pale compared
to the task of weeding out all references to that variable elsewhere
in the source code.

I have always believed in maintaining well-stratified conceptual
levels in my source code, to whatever extent possible.  In C, macros
help to clean up top-level source code somewhat, without the overhead
that excessive function calls would introduce.  Now, I consider a
.header file to be a template for program development; this is quite a
different conceptual level from actual data, which an initialized
variable represents.

In fact, it's not really the initialization which is bad, but the
*definition* (as opposed to declaration) of the variable in the .header
file which is wrong, never mind whether you initialize it or not.  It all
comes down to the difference between a programming environment and a
program environment.  The .header file describes the programming
environment; the preamble to the source module describes the program
environment.  A place for everything, and everything in its place.
-- 
Jim Vlcek
vlcek@caf.mit.edu
!{ihnp4,harvard,seismo,rutgers}!mit-eddie!mit-caf!vlcek