|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2005-05-11 19:30:04
"Mathew Robertson" <mathew.robertson_at_[hidden]> wrote in message
news:029001c554fe$1664d360$a901000a_at_mat...
>> >> However it is implemented, it should be 'named' so that it is
>> >> obvious to a person reading over the code, that the test is checking
>> >> for a specific capability.
>> >
>> > Agreed. That's part of the point I'm trying to make with Peter.
>>
>> The is_other test _isn't checking_ for a specific capability! That's the
>> whole point!
>
> apologies... when I said "... the test is checking for a specific
> capablity." it came across wrong.
>
> What I meant was, if we have code like:
>
>
> if (is_file("/some/path/")) {
> ...
> }
>
>
> [ where "/some/path/" is a directory in the traditional sense ]
>
> The 'checking' is not "does the capability exist" -> rather "is the
> capability true", where false would be a result of the platform not
> supporing a valid implementation of is_file() or it isn't an actual file.
>
>
>
> That said, these is_blah()'s are really tri-state values - not boolean.
> Should their specification be:
>
> int is_file(const char *)
>
> where the return values can be:
>
> -1 error, and errno is set with the error value
> 0 false
> 1 true
Well, that is what is intended, although for the is_blah() functions the
error is communicated by throwing an exception. status() provides the
functionality for users who want an explicit error return (with error code)
rather than an exception.
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk