delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/01/23/15:27:18

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3E304571.BFA087FF@phekda.freeserve.co.uk>
Date: Thu, 23 Jan 2003 19:41:37 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
CC: djgpp-workers AT delorie DOT com
Subject: Re: ssize_t: int -> signed long [PATCH]
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1030123081522 DOT 15630C AT is> <3E2FB5F0 DOT B7FD75FC AT phekda DOT freeserve DOT co DOT uk> <1659-Thu23Jan2003203612+0200-eliz AT is DOT elta DOT co DOT il>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Eli Zaretskii wrote:
> 
> > Date: Thu, 23 Jan 2003 09:29:20 +0000
> > From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
> > >
> > > Why not make it ssize_t?  That way, we avoid any breakage in the future,
> > > if ssize_t is changed.
> >
> > I thought about that and it should work. But then we pollute <stdio.h>
> > with ssize_t. Is that good, bad or ugly?
> 
> No, we don't pollute stdio.h because it already includes sys/djtypes.h
> which defines ssize_t.

I don't think <sys/djtypes.h> does actually pollute. It #defines something
which typedefs ssize_t. So unless we use this define in <stdio.h>, there is no
pollution.

From <sys/djtypes.h> after the patch:

    #define __DJ_ssize_t	typedef long signed int ssize_t;

So if <stdio.h> doesn't use __DJ_ssize_t, then ssize_t will not pollute
<stdio.h>.

> > > Again, why not change the return value to ssize_t?  Will that break
> > > anything?
> >
> > The return type is already ssize_t. The problem is that there are two
> > possible return values: one from FSEXT, one from normal operation. The
> > normal operation path can work with ssize_t. The FSEXT call returns an
> > int:
> >
> >     int function(__FSEXT_Fnumber func_number, int *rv, va_list args);
> 
> Perhaps we should change FSEXT to return an ssize_t.

If we're going to change it, I would prefer a long long, since then it will
cope with return values from anything (llseek, etc.). But that's not binarily
compatible, so what you suggest is better. Unless we're not worried about
binary compatibility with FSEXTs?

Thanks, bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019