Porting style [was Re: GPG port to TANDEM]

David Shaw dshaw at jabberwocky.com
Tue Jan 14 18:23:10 CET 2003


On Tue, Jan 14, 2003 at 10:57:35AM -0600, David Champion wrote:
> * On 2003.01.14, in <87el7gcalr.fsf at alberti.g10code.de>,
> *	"Werner Koch" <wk at gnupg.org> wrote:
> > 
> > We don't accept changes which render the code unreadable; especially
> > #ifdef __some_ostype__ are in general not acceptable.  There are
> 
> How should it be done? I would have expected the alternatives to be
> less likely to be accepted, so I'm not sure what approach to take. All
> hypothetical, but as a open-source contributor with far more patches
> rejected than accepted, this kind of thing intrigues me.

One way to minimize ifdefs growing all over the code is to confine
them to a given place and then call that place.  For example, see the
code that handles external program calls in g10/exec.c and
g10/photoid.c.  That's the sort of code that you pretty much can't
avoid ifdefs in as program execution is going to be different on
different platforms.  However, all of the calls to the exec_*
functions and show_photos are simple and readable.

David

-- 
   David Shaw  |  dshaw at jabberwocky.com  |  WWW http://www.jabberwocky.com/
+---------------------------------------------------------------------------+
   "There are two major products that come out of Berkeley: LSD and UNIX.
      We don't believe this to be a coincidence." - Jeremy S. Anderson




More information about the Gnupg-devel mailing list