Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsh!daw From: daw@cbnewsh.att.com (David Wolverton) Newsgroups: comp.lang.c Subject: Re: structured entry of #if preprocessor commands Message-ID: <1991Feb13.183600.12427@cbnewsh.att.com> Date: 13 Feb 91 18:36:00 GMT References: <1991Feb10.063915.5476@ccu.umanitoba.ca> <1991Feb10.204604.28908@athena.mit.edu> Distribution: na Organization: AT&T Bell Labs, Holmdel, NJ Lines: 42 In article <1991Feb10.204604.28908@athena.mit.edu>, scs@adam.mit.edu (Steve Summit) writes: > What I can't explain is why the following style, which most old > compilers would accept, has never been widespread (and which > therefore looks equally weird to me): > > #if defined(MSDOS) > # if defined(ANSI) > # include "ms_ansi.h" > # endif > #else /* not msdos */ > # if !defined(ATARIST_MWC) && !defined(MAC) && !defined(AMIGA) > # ifndef VMS > # include > # endif > # include > # endif > #endif I experimented with this style, but never really fully adopted it, partly because it isn't widespread, as Steve points out. But another reason was the early lack of "#elif", which makes the indentation sometimes look a little weird: #if CHOICE_1 # define FOO "abcd" #else /* would rather have a single */ #if CHOICE_2 /* #elif CHOICE_2 here */ # define FOO "efgh" #else #if CHOICE_3 # define FOO "ijkl" #endif /* trebled #endif's due to lack */ #endif /* of #elif */ #endif Unfortunately, it often seemed to me that precisely the times when using indentation would clarify the meaning were also the times when #elif was useful. Dave Wolverton daw@attunix.att.com