Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2004-02-01 16:50:24


At 11:25 AM 2/1/2004, Momchil Velikov wrote:

> 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")));

And of course there is always (d) "compiler magic" :-)

>
> 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.

OK, thanks for the clarification. I'll be careful not to do that. A trial
implementation should be in CVS in few days - that will allow months of
testing before the next release.

--Beman


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