*BSD News Article 5742


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!uunet!europa.asd.contel.com!darwin.sura.net!jvnc.net!yale.edu!think.com!rpi!psinntp!psinntp!ficc!peter
From: peter@ferranti.com (peter da silva)
Subject: Re: 386BSD's non-standard C library
Message-ID: <id.58NT.RE4@ferranti.com>
Organization: Xenix Support, FICC
References: <1992Sep24.031603.21009@minyos.xx.rmit.oz.au>
Date: Mon, 28 Sep 1992 21:38:51 GMT
Lines: 44

In article <1992Sep24.031603.21009@minyos.xx.rmit.oz.au> rcskb@minyos.xx.rmit.oz.au (Kendall Bennett) writes:
> Hmph. I assumed that the standard C library for 386BSD (the one that
> comes with 0.1 bindist/srcdist) would be standard,

It is. It's a standard K&R library.

> so my ANSI C
> conforming programs would work no problems.

Ah. That's your problem. You're using a newer standard.

> Well, it seems that the
> library is far from standard and is taking a number of shortcuts.

Not shortcuts, exactly. The library *predates* the standard. For example,
the ANSI standard changed the behaviour of tolower for most compilers.

Portable code should be written in the expectation that there are still
a lot of old compilers out there. The portable version of your code is:

	if(isupper(c))
		c = tolower(c);

> I fixed the above problem, but the program core dumps with a bus error,

I dare say.

Anyone with pretentions of writing portable code should be forced to port
their code to (say) Xenix-286.

That'll separate the men from the boys.

> so I have no idea what is going on (and I hate using dbx :-( ).

Oh yeh, you'd REALLY hate adb.

> What can be done about this? There are a number of solutions.

Fix your code. Run lint over it until it lints clean.
-- 
Peter da Silva                                               `-_-'
Ferranti Intl. Ctls. Corp.                                    'U` 
Sugar Land, TX  77487-5012
+1 713 274 5180                                   Har du kramat din varg idag?