Re: [Boost-users] [BULK] Re: [BULK] [filesystem] function to determineavailable space

-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Beman Dawes Sent: Monday, September 12, 2005 2:20 PM To: boost-users@lists.boost.org Subject: [BULK] Re: [Boost-users] [BULK] [filesystem] function to determineavailable space Importance: Low
"Sohail Somani"
wrote in message news:1C1EBEF8DBACDC439D038EA051674EC709C5D4@xbox.financialcad.com... -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Beman Dawes Sent: Monday, September 12, 2005 10:23 AM To: boost-users@lists.boost.org Subject: [BULK] [Boost-users] [filesystem] function to determine available space Importance: Low
I'm planning to add a filesystem function to determine available disk space. Perhaps something like:
struct space_status { boost::uintmax_t available; // free space available to user boost::uintmax_t total; // total space on volume };
space_status filesystem_space( const path & p );
Comments?
Standard unit of measure? Bytes? Megabytes? Gigabytes?
Bytes. Individual bytes still matter in some applications.
What about using a type that guarantees a certain amount instead of just "max" (which may vary)? Or equivalently, are we guaranteed that uintmax_t can hold, say one TB, on any platform that boost supports?

On 12/09/05, Sohail Somani
What about using a type that guarantees a certain amount instead of just "max" (which may vary)? Or equivalently, are we guaranteed that uintmax_t can hold, say one TB, on any platform that boost supports?
Even 1 TB isn't really safe. I know a number of people with more total storage than that. How about a double? The imprecision shouldn't be a worry -- if you're beyond the range of a double's precision for free space then being off by even a few MB it doesn't matter and doubles are perfectly precise for small integral numbers. ( on x86 linux it seems my 64-bit doubles have 53 bits of mantissa meaning they're perfectly precise for anything less than 8192 TeraBytes. I don't know what the standard specifes though, and my 32-bit floats are only perfectly precise for under 16 MB. That being said, even the 32-bit float has a max of over 3e26 TB, so just saying the precision of the number returned is dependant on the precision of your platform's double would get around that, assuming of course we can assure that any rounding is done on the safe side. ) Also, the implementation could work internally in whatever it wants to keep perfect precision and just feed out a double at the end. - Scott McMurray
participants (2)
-
me22
-
Sohail Somani