Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2004-02-03 15:13:07


At 12:48 PM 2/3/2004, Powell, Gary wrote:

>Beman wrote:
>
>How should size( "foo" ) behave if "foo" is a directory?
>
>1) Throw. The function should be renamed file_size().
>
>2) Return 0. Directories don't strictly speaking have a size.
>
>3) Return the number of entries in the directory. Directories are really
>just containers; so of course they have a size.
>-------------------------------------------------
>Gary Replies:
> #1, while an OS can implement directories as a file of information, I
>think its conceptually wrong for this function to ask for its "size".
When
>iterating through a file system you should first guarantee that the file
>name is a file and not that of a sub directory.
>
> The 4th answer would be to return the total size of all the files
within
>the directory. But I think that's also conceptually confusing as well.

Agreed.

(1) is the behavior in the preliminary version that is now in CVS.

--Beman


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