*BSD News Article 30924


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!gatech!prism!prism!not-for-mail
From: gt8134b@prism.gatech.edu (Robert Sanders)
Newsgroups: comp.os.386bsd.development
Subject: Re: Request to ``ports'' developers
Date: 28 May 1994 18:36:15 -0400
Organization: Georgia Institute of Technology
Lines: 40
Sender: gt8134b@prism.gatech.edu
Message-ID: <2s8h0v$5ha@acmex.gatech.edu>
References: <2s291q$pnl@meatball.rwwa.com> <2s37a4$mp9@pdq.coe.montana.edu> <VIXIE.94May27220527@office.home.vix.com> <hm.770154713@hcswork>
NNTP-Posting-Host: acmex.gatech.edu

hm@hcswork.hcs.de (Hellmuth Michaelis) writes:

>In <VIXIE.94May27220527@office.home.vix.com> vixie@vix.com (Paul A Vixie) writes:

>>When you add #ifdef's and code to a package, you should always use the least
>>specific macro that describes the feature you're depending on.

>What about testing ? What if i had just a 386|Net|FreeBSD for testing ? The
>only thing i will be SHURE after porting and testing is that it run's on
>the particular 386|Net|FreeBSD platform/version.

>This is no offense! You are really right in the quoted sentence above, but
>i have mixed feelings about it when it comes to the real world.

The best way to do that would be to not conditionalize on system type at
all, but on specific attributes of those systems.  For example, this is a code
snippet from some package I had handy:

#ifdef I_UTIME
#include <utime.h>
#endif

Now, if the author had chosed to conditionalize on some SystemX that needed to 
include utime.h, he would've changed the I_UTIME to SYSTEMX.  Now, say some other
system, SystemY came along; he'd have to change that ifdef to 

#if defined(SYSTEMX) || defined(SYSTEMY)

but if he left it "#ifdef I_UTIME", he could just use some separate configuration 
file, or a bunch of configuration files, one per system, that defined the proper
"generic" attribute macros like I_UTIME.

While this discipline is certainly easier to follow if the original author had
already done so, it's not impossible to do on packages that were conditionalized
the incorrect way.
-- 
 _g,  '96 --->>>>>>>>>>   gt8134b@prism.gatech.edu  <<<<<<<<<---  CompSci  ,g_
W@@@W__        |-\      ^        | disclaimer:  <---> "Bow before ZOD!" __W@@@W
W@@@@**~~~'  ro|-<ert s/_\ nders |   who am I???  ^  from Superman  '~~~**@@@@W
`*MV' hi,ocie! |-/ad! /   \ss!!  | ooga ooga!!    |    II (cool)!         `VW*'