lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Am 29.04.2014 02:08 schröbte William Ahern:
On Mon, Apr 28, 2014 at 08:51:41PM +0200, Philipp Janda wrote:
Am 28.04.2014 19:10 schr??bte Roberto Ierusalimschy:
On 28/04/14 16:44, Roberto Ierusalimschy wrote:


(Sorry for the delay.) How can stdio.h not define 'off_t' but define
'fseeko', which uses 'off_t' in its prototype?

-- Roberto


Not in 10.4 it would seem [1]
int	 fseeko(FILE *, fpos_t, int);

[1] http://www.opensource.apple.com/source/Libc/Libc-391/include/stdio.h

So, 10.4 is not POSIX :-(

As long as sys/types.h contains something equivalent to

     typedef fpos_t off_t;

it should be fine. E.g. my Linux stdio.h contains

     extern int fseeko (FILE *__stream, __off_t __off, int __whence);

but the typedef is in the same file, so no problem here.

I think the fool-proof POSIX solution would be to include sys/types.h.


POSIX.1-2008 requires stdio.h to define off_t:

	The <stdio.h> header shall define the following data types through
	typedef:
	...
	off_t
		As described in <sys/types.h>.

However, OS X is certified as POSIX.1-2001 compliant, where only fpos_t was
required to be defined by stdio.h.

Ah, good to know.

The question is, what versions should Lua
try to remain compatible with? OS X 10.4 is really old (2005, long before
POSIX.1-2008 was released), and 10.9 is a free upgrade.


But is there any reason not to include sys/types.h and be done with it? AFAICS, sys/types.h must contain a definition for off_t in both POSIX versions ...

Philipp