Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2002-08-19 13:25:31

From: Beman Dawes <bdawes_at_[hidden]>
> At 08:06 PM 8/18/2002, Jeff Garland wrote:
> >Unfortunately, I really need access to the file size for the program I
> >am working on. I take it that the plan is that these properties are not
> >coming back into the library in the near term, or should I be thinking
> >about hacking some sort of extension?
> The questions that come to mind are:
> * What type should a size function return? Trickier than it sounds since
> many operating systems support file sizes larger than can be represented by
> a long. uintmax_t sounds better, but are we promising more than can be
> delivered if uintmax_t is too small (probably 32-bits) to hold the
> platform's maximum file size?

Windows provides an API that returns a large integer type plus has an output
parameter for the overflow because there isn't a sufficiently large integer
available. On Solaris 2.8, stat has a field of type off_t, which maps to long
or long long, depending upon whether the application is 64 bit aware.

I should think returning a std::pair<unsigned, unsigned>, or something like that
would provide adequate capacity for all platforms. I don't think you want to
use a pair for some platforms and not for others, and I think that a pair is
needed for some, so I think you should always return a pair, even if the type in
the pair changes with platform.

Rob Stewart                           stewart_at_[hidden]
Software Engineer           
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at, gregod at, cpdaniel at, john at