*BSD News Article 6084


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!sgiblab!darwin.sura.net!Sirius.dfn.de!math.fu-berlin.de!hrz.tu-chemnitz.de!wutcd
From: wutcd@chemnitz.guug.de (Joerg Wunsch)
Subject: Re: 386BSD's non-standard C library
Message-ID: <wutcd.718307669@hadrian>
Sender: bin@hrz.tu-chemnitz.de (Owner of all binaries)
Organization: tu-chemnitz
References: <1992Sep24.031603.21009@minyos.xx.rmit.oz.au> <id.58NT.RE4@ferranti.com> <rcskb.718045970@minyos.xx.rmit.OZ.AU> <1992Oct2.210133.3625@fcom.cc.utah.edu>
Date: Mon, 5 Oct 1992 17:54:29 GMT
Lines: 41

Well Terry,

i agree with most of your statements. But, with respect to ANSI, my thoughts
are some different.
K&R has not been declared to be a standard. There have been many changes
since early K&R to the latest pre-ANSI compilers and libraries. (Have a
look at the various configuration dependencies contained within the GNU
packages.) That's the reason, only an ANSI compiler defines ``__STDC__''
which implies that this is _the_ standard.

Of cource, when writing code for a variety of systems, this should imply
the possibility of compiling it on a K&R compiler, whatever one could
understand for this term. Possibly, there should be #ifdefs whenever
needed or appropriate. For example, the toupper() could be defined
like
  #ifndef __STDC__
  #define toupper(c) (islower(c)? _toupper(c): c)
  #endif
or similiarly.

But when compiling for any modern environment (all *-Dos compilers,
and 386BSD with its gcc, for example) i prefer writing (almost) strict
ANSI code, i. e. my gcc won't warn anything when compiling with -Wall
(except the sccsid:-). There are security reasons: the prototypes will
show typos and other errors in an early stage of compilation, some
better defined implicit type conversions make live easier. Rather than
linting _and_ compiling, everything is done in one step (and thus faster
since there's only _one_ parsing of input). And believe, gcc -Wall warns
a lot (maybe more than lint? - e.g. forgotten arguments in a printf list?).
But - this is applicable only when the destination of my program is some
system i'm sure about there's an ANSI compiler. When programming for
386BSD, this is always true.

	vy 73!
	J"org (ham call: y43tl)

--
J"org Wunsch, TCD GmbH Dresden, R"ahnitzgasse 18, D-O-8060 Dresden
                                                              \     ~.~. 
	joerg_wunsch%bonnie@hadrian.hrz.tu-chemnitz.de         \   ~  | ~ 
	voice: +49-351-5965 137                                 \    ===