delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/12/15:27:59

Newsgroups: comp.os.msdos.djgpp
From: Peter Berdeklis <peter AT atmosp DOT physics DOT utoronto DOT ca>
Subject: Re: Z-buffering for Allegro (long)
Message-ID: <Pine.SGI.3.91.970912135239.14612A-100000@atmosp.physics.utoronto.ca>
Nntp-Posting-Host: chinook.physics.utoronto.ca
Sender: news AT info DOT physics DOT utoronto DOT ca (System Administrator)
Mime-Version: 1.0
Organization: University of Toronto - Dept. of Physics
In-Reply-To: <3415892c.870208@news.eunet.be>
Date: Fri, 12 Sep 1997 18:10:55 GMT
References: <34145012 DOT D39BD118 AT xs4all DOT nl> <Wixm8LAnEHF0Ewxr AT talula DOT demon DOT co DOT uk> <3415892c DOT 870208 AT news DOT eunet DOT be>
Lines: 56
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Tue, 9 Sep 1997, please remove the nospam part wrote:

> On Mon, 8 Sep 1997 22:41:59 +0100, Shawn Hargreaves
> <Shawn AT talula DOT demon DOT co DOT uk> wrote:
> 
> >Partly, I'm worried that Allegro is just getting too big, and that many
> >people only need a small subset of what it provides. Modularity, and
> >optional downloading of components, can only be a good thing...
>
> If you want that advantage with a modular version, you'd still need
> someone to do the 'administrative' work of making sure that everything
> still works together. The total work load would even increase, since
> you'd have several packages to be maintained, instead of one.
> 
> And in the end, you'de have several Allegro versions. One modified
> version that works together with this package, and another one that
> doesn't, but supports true color modes, execept for the 3D part,
> therefore you'd need ... etc ... catch my drift?

I hate to criticize Shawn's programming, because he obviously knows what
he's doing.  However, making modular libraries has nothing to do with
having several versions of the library.  In fact with proper planning,
making modular libraries is fairly easy. 

The linker will always only link in those modules in the library that are
reference by other modules, not the whole library.  That's why the entire
std C library is not linked in when you use printf().  Only those modules
that printf() references are linked in.  That includes any module that
does housekeeping for printf(), or contains global variables that printf()
uses (another reason that globals are A Bad Thing, by the way). 

To create a modular library you must be strict about keeping only one
function per file, or 1 func + any func's that the first uses, which are
not used by other func's.  In the 2nd case you don't declare the function
in a header file to make sure that it's not used elsewhere.  Also, any
global variables should be seperated into their own file with related
variables, and with no functions.  Then only the variable(s) gets linked
in. 

All of this is easy to say in hindsight, but it is quite a pain in the ass
to do after the library has gotten too big. 

I'm guessing that Shawn, like most of us, started the project as someone
who had done lots of small projects and one day found himself in the
middle of a large project.  At that point you've often gone past the point
where you want to spend the significant time required to fix the mistake,
rather than just keep improving what you're currently working on. 

Just another indication that it's always important to be disciplined about
your programming style, because you never know where your work is going to
lead. 

---------------
Peter Berdeklis
Dept. of Physics, Univ. of Toronto

- Raw text -


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