*BSD News Article 5915


Return to BSD News archive

Path: sserve!manuel!munnari.oz.au!bruce.cs.monash.edu.au!monu6!escargot!minyos.xx.rmit.OZ.AU!rcskb
From: rcskb@minyos.xx.rmit.oz.au (Kendall Bennett)
Newsgroups: comp.unix.bsd
Subject: Re: 386BSD's non-standard C library
Date: 2 Oct 92 17:12:50 GMT
Organization: RMIT Computer Centre
Lines: 75
Message-ID: <rcskb.718045970@minyos.xx.rmit.OZ.AU>
References: <1992Sep24.031603.21009@minyos.xx.rmit.oz.au> <id.58NT.RE4@ferranti.com>
NNTP-Posting-Host: minyos.xx.rmit.oz.au

peter@ferranti.com (peter da silva) writes:

>In article <1992Sep24.031603.21009@minyos.xx.rmit.oz.au> rcskb@minyos.xx.rmit.oz.au (Kendall Bennett) writes:

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

Well if it is, it is pre-historic.

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

Oh? That is my problem? I assume that since this is a new standard (first
proposed back in what - 1983?), and it is not supported on all systems
I should not use it, but write my code in pre-historic K&R C with lotsa
#defines since non K&R system is ever comapatable with another?

Well I hate to inform you, but this is the totally wrong approach. I 
write all of my C code so that it is ANSI conforming, and any UNIX
stuff I write I try to make it POSIX conforming. Now if it so happens
that my code does not run on your system because your compiler and
runtime library and ancient - well you will simply have to update you
compiler and runtime library.

Take a look at the code for the GNU standard C library. It is written
to work under K&R C compilers, and I pity having to write code like this.
But I shouldn't have to. Once you have and ANSI C compiler (like gcc)
and an ANSI C runtime library up and running, you wont need to resort
to this type of code.

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

Well, you see the runtime library has the __STDC__ and __POSIX_SOURCE
macro definitions all over the place - this made me assume it was
attempting to be ANSI/POSIX conformant. Condidering that the implemenation
of tolower in the 386BSD library does not match what the man pages say,
how an I to know without looking at the code that the rest of the
library does what it is supposed to do?

>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:

I'll leave this type of 'portable' coding up to you - me, I'll stick to
the standards and wait for the vendors to get with it.

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

Ha ha. Why not make people who write UNIX apps port their code to run
under MSDOS? Nice and segemented like Xenix-286.

>Fix your code. Run lint over it until it lints clean.

This is something I have never been able to do. I do most of my
development under MSDOS, since the best programming development 
systems I have ever used run under MSDOS. Good DOS compilers like
Borland C++ will pick up just about anything lint will pick up, and
you dont need to put horrible #ifdef lint and (void)printf(...) stuff
throughout your code just so lint wont barf.

Sometimes I really wonder when the UNIX world will catch up with
the technology that is currently available on DOS based systems for
program development. Believe me, integrated development environments
are incredibly usedful when you are trying to _teach_ people about
programming, allowing students to actually hand execute code interactively
watching how things change. I have yet to see anything that comes
anywhere near as close on UNIX platforms...

+------------------------------------------+-------------------------------+
| Kendall Bennett                          | Internet:                     |
| RMIT Advanced Computer Graphics Centre   | kjb@citri.edu.au              |
| CITRI Building, 723 Swanston Street      | rcskb@minyos.xx.rmit.oz.au    |
| Carlton Victoria 3053 AUSTRALIA.         |                               | 
+------------------------------------------+-------------------------------+
| CoSysop (Bossman), PC Connection Australia:               +61 3 688 0909 |
+--------------------------------------------------------------------------+