__USE_FILE_OFFSET64与_FILE_OFFSET_BITS = 64 [英] __USE_FILE_OFFSET64 vs. _FILE_OFFSET_BITS=64

查看:1775
本文介绍了__USE_FILE_OFFSET64与_FILE_OFFSET_BITS = 64的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图维护在许多不同系统上编译的代码。我看过十几种不同的方式来询问需要64位的 lseek 。一些系统使用 lseek64 ,有些使用 lseeko ,有些需要定义 _FILE_OFFSET_BITS = 64 ,现在我找到一个新的,需要你定义 __ USE_FILE_OFFSET64

I am trying to maintain code that compiles on lots of different systems. I've seen a dozen different ways of asking for lseek that takes 64-bits. Some systems use lseek64, some use lseeko, some require that you define _FILE_OFFSET_BITS=64, and now I just found a new one that requires that you define __USE_FILE_OFFSET64.

这是否有任何标准?

推荐答案

IEEE Std 1003.1-2004中的getconf值(以及 IEEE Std 1003.1-2008 ;也参见这些文献中的实施例部分)。

There are getconf values in IEEE Std 1003.1-2004 (and a newer set in IEEE Std 1003.1-2008; see also the EXAMPLES section in those documents). Actual compiler options (which might not even be defines) are not specified.

但是,autoconf中的 AC_SYS_LARGEFILE 宏不会指定实际的编译器选项不尝试使用它 - 它尝试只是 -n32 为IRIX, -D_FILE_OFFSET_BITS = 64 (这应该工作大多数系统)和 -D_LARGE_FILES = 1 (显然对于AIX)。还可以参考向单个UNIX规范添加对任意文件大小的支持<

However, the AC_SYS_LARGEFILE macro in autoconf does not try to use this — it tries just -n32 for IRIX, -D_FILE_OFFSET_BITS=64 (which should work for most systems) and -D_LARGE_FILES=1 (apparently for AIX). There is also a reference to Adding Support for Arbitrary File Sizes to the Single UNIX Specification (an older spec draft which was then partially included in the POSIX.1 spec) in autoconf sources.

至于定义 __ USE_FILE_OFFSET64

As for defining __USE_FILE_OFFSET64 manually, not sure if this is really a correct solution — double-underscore macros are reserved for system headers, and most likely there is some conditional definition there which depends on other defines.

这篇关于__USE_FILE_OFFSET64与_FILE_OFFSET_BITS = 64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆