Mail Archives: djgpp-workers/2003/01/23/05:35:19.1
Hello.
Eli Zaretskii wrote:
>
> On Wed, 22 Jan 2003, Richard Dawe wrote:
>
> > * The _cnt member of FILE is now a long. In src/libc/ansi/stdio/filbuf.c
> > &f->_cnt is passed to __libc_read_termios_hook, which expects a ssize_t
> > argument. &f->_cnt being an int * cannot be converted without typecasts
> > to ssize_t *. Hence I changed f->_cnt to be a long.
>
> 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? If there are no objections, then I'm happy
with ssize_t for _cnt.
> > * In write() the return value 'rv' was an int. But it's used to store
> > both an int and a ssize_t. Now they are not the same as int,
> > two variables are needed - 'i_rv' and 'ss_rv' for int and ssize_t
> > respectively.
>
> 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);
So there are now two return value variables used in the code: i_rv for the
FSEXT-related code and ss_rv for the normal operation.
Bye, Rich =]
--
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]
- Raw text -