Boost logo

Boost :

From: Momchil Velikov (velco_at_[hidden])
Date: 2004-02-01 11:25:45


>>>>> "Beman" == Beman Dawes <bdawes_at_[hidden]> writes:

    Beman> At 04:33 AM 2/1/2004, Momchil Velikov wrote:
>> All files must be compiled with the same _FILE_OFFSET_BITS. You
>> don't want to get binary incompatible objects just because one
>> happened to include the above header[1] and the other didn't.
>>
>> ~velco
>>
>> [1] The program may have reasons to use struct stat independed of the
>> presence of boost.

    Beman> Hum... Perhaps mistakenly, I assumed stat() was a macro that expanded
    Beman> to call stat64() if _FILE_OFFSET_BITS=64 was defined.

  Indeed, probably is is "redirected" in some way to the appropriate
syscall/function name. E.g. glibc on GNU/Linux can do something like:

  a) #define stat stat64, or

  b) extern int stat (struct stat *) asm ("stat64"), or

  c) extern int stat (struct stat *) __attribute__ ((weak, alias("stat64")));

    Beman> Put another way,
    Beman> is a program linking these two files OK?

    Beman> file_a.cpp
    Beman> #define _FILE_OFFSET_BITS=64
    Beman> #include <sty/stat.h>
    Beman> long long func_a()
    Beman> {
    Beman> struct stat s;
    Beman> if ( stat( "foo", &s ) != 0 ) { throw ... }
    Beman> return s.st_size;
    Beman> }

    Beman> file_b.cpp
    Beman> #include <sty/stat.h>
    Beman> long func_b()
    Beman> {
    Beman> struct stat s;
    Beman> if ( stat( "bar", &s ) != 0 ) { throw ... }
    Beman> return s.st_size;
    Beman> }

  Yes, this is probably ok. The problem is if parts of the program
attempt to communicate ``struct stat'' values.

~velco


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk