Date: Thu, 18 Jan 1996 02:33:03 -0700 From: Chris Torek <torek@BSDI.COM> To: jkh@time.cdrom.com, markd@grizzly.com Cc: hackers@freebsd.org Subject: Re: Change to stdio.h to export `cookie?' Message-ID: <199601180933.CAA22395@bsdi.BSDI.COM>
next in thread | raw e-mail | index | archive | help
>If fd is -1, as it is when uninitialized ... It is not uninitialized, it is deliberately set to -1 to mean `not associated with a file descriptor'. There is no reasonable nonnegative value to put here, since there is no (theoretical) limit on the number of descriptors per process. >#define fpending(fp) ((fp)->_p - (fp)->_bf._base) Probably not a bad idea, though this is only correct for write-mode. A more general version might be proposed and sent to ANSI for C9X... >#define fcookie(fp) ((fp)->_cookie) This (a) assumes that there is some magic value associated with a `FILE *' and (b) that it has meaning to someone outside the read/write/ seek/close functions. I find this suspicious. Were stdio a C++ thing, fp->_cookie would be a private member.... >#define ffd(fp) ((fp)->_file) Same as existing fileno(fp). Chris
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199601180933.CAA22395>