RE: ANSI standards


Subject: RE: ANSI standards
From: James Montgomerie (jamie@montgomerie.net)
Date: Thu Jan 20 2000 - 13:21:31 CST


Hello all, I've just joined the list, and I am interested in becoming
involved in development. However, the source to something as large as
AbiWord is rather daunting to look at and understand in one gulp, so I'm
looking for something to do that wouldn't be too hard for an AbiWord
'newbie', but would give me an overview of the system (this might be too
much to ask though...).

I've done a little with cross-platform coding before, so I thought that
'fixing up' these non-ANSI string functions might be a good thing to try.
(Scroll down - there's more :-)

> -----Original Message-----
> From: owner-abiword-dev@abisource.com
> [mailto:owner-abiword-dev@abisource.com]On Behalf Of
> d.rose@salford.ac.uk
> Subject: Re: SV: ANSI standards
>
> On Thu, Jan 20, 2000 at 02:07:03PM +0100, Henrik Berg wrote:
> > > According to bug 238, several string manipulation functions
> > > that we use are not ansi standard. I did some checking, and
> > > here are the platforms on which we use the functions in question:
> > >
> > > strdup
> > > BEOS Unix QNX
> > >
> > > stricmp, strnicmp
> > > Win32 QNX
> > >
> > > strcasecmp, strncasecmp
> > > BEOS
> >
> >
> > The one I don't regornice is strcasecmp and strncasecmp, but
> > its just stricmp and strnicmp with other names isn't it? strdup
> >is just a little bad, since it need a free call.
> >
> > If stricmp and strnicmp is present on BEOS, it would be nice to
> > change, but thats just me, I dont do BEOS, so I don't have a say.
> >
> > --hb
> >
>
> None of these are mentioned in K&R 2, and the man pages for strdup,
> strcasecmp, strncasecmp state BSD conformance rather than ANSI. I don't
> have man pages on my (Linux) box for stricmp, strnicmp.
>
> I guess none of these functions are ANSI.

As far as I know, none are ANSI - strdup is non-ansi, but pretty standard,
strcasecmp and stricmp are Microsoft and GNU versions of a case-insensitive
strcmp respectively (as you might guess from where they're being used in
AbiWord). (They probably stretch to other compilers too, but I have no
experience of these).

Forgive the following questions, which might have an established and obvious
answer to 'older' list-members:

As these appear to be used in the machine-specific code branches, does it
matter that they're non-ANSI [I presume LOTS of the platform-specific code
is non-ANSI]? If they are in the platform-independent code, could someone
point them out (my cursory find and grep produced nothing using these
functions in the platform independent code).

If they /do/ require replacement I'd be happy to trawl through fixing them,
if someone points me in the direction of where should the new ANSI-compliant
replacement functions should go [that's where the actual code for the
srtcasecmp replacement etc. functions should go - i.e. a utility file - not
where they should be used, I can find that myself], and the naming
conventions I should use.

Jamie.



This archive was generated by hypermail 2b25 : Thu Jan 20 2000 - 13:18:53 CST