Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2002-08-20 19:08:16

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

It seems that this is a perfect example of why the standard needs
to be extended to include a 64 bit type (the date-time library
is another example where a 64 bit time is extremely handy for
creating an efficient implementation). Since many C++ compilers
support this extension it seems like we could use boost::int64_t
and then perhaps some simulated 64 bit type using a pair of
int32_t for the platforms that don't support it. But this seems
like an awful lot of work for this...
> * Can a size function be reliably implemented on any operating system
> likely to be able to support the Filesystem Library? The answer is yes for
> most modern mainstream OS's, and yes for many small legacy OS's, at least
> if an allowable implementation is to open the file, seek to the end, get
> the position, close the file, and report the result.

Hmmm, the performance for the open, seek, close would really need to
be documented.
> * What would be a good name? (Remember from prior messages that if the
> function name is foo, and pth is a fs::path, we want foo( pth ) to be
> valid, but to be invalid.) "file_size" is one obvious candidate.

How about size_in_bytes....

The thing you didn't answer in the last email was what the plan is for
the general support of properties (of which size would seem to be one).
At one point there was a table of properties which Jan or someone was
looking at implementing. Is that just going into phase 2 or something?
My worry is that if you implement size, next week I'll be asking you
for modified date or something else.


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