On 11/25/13 at 09:08pm, Allan McRae wrote: > On 22/11/13 22:37, Jeremy Heiner wrote: > > On Thu, Nov 21, 2013 at 3:52 PM, Allan McRae <[email protected]> wrote: > >> Nope - documenting is the only real way to deal with this. For example: > >> > >> http://www.gnupg.org/documentation/manuals/gpgme/Largefile-Support-_0028LFS_0029.html > > > > How about the approach outlined in the attachment? It passes 'make > > check' and performs correctly when a libalpm client app goofs up. > > > > Please send patches inline so we can easily comment. > > I was quite surprised this worked: > > +#define alpm_initialize(root,dbpath,err) \ > + alpm_initialize_check_largefile(root, dbpath, err, sizeof(off_t)) > > The sizeof(off_t) gets evaluated before the #define? That can't be > right... So must be optimised out? I'm either missing something here > or this is prone to breakage.
If I'm not mistaken, sizeof is evaluated at compile time. This works because the sizeof(off_t) in the #define is evaluated when the calling program is compiled and the sizeof(off_t) inside alpm_initialize_check_largefile is evaluated when alpm is compiled. > I guess a working approach would be to find the size of off_t during > configure (e.g. [1] - there are other approaches) and test sizeof(off_t) > == SIZEOF_OFF_T in alpm_initialise. I don't see how this would work. Because sizeof is a compile-time operation, it *must* be provided by the program using alpm. > Allan > > [1] > http://www.gnu.org/software/autoconf-archive/ax_compile_check_sizeof.html
