Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2004-10-11 10:44:20


At 10:01 AM 10/11/2004, Liao Weijie wrote:
>// the snip of code in filesystem::is_directory begin---
>
> DWORD attributes = ::GetFileAttributesA(
>ph.native_directory_string().c_str() );
> if ( attributes == 0xFFFFFFFF )
> boost::throw_exception( filesystem_error(
> "boost::filesystem::is_directory",
> ph, fs::detail::system_error_code() ) );
> return (attributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
>
>//-------------------------------------------------------end--
>
>When GetFileAttributesA failed but the exception is disabled, the
>(attributes & FILE_ATTRIBUTE_DIRECTORY) will always be true.
>
>Is it a bug?

No. It is undefined behavior for boost::throw_exception() to return.

To quote the throw_exception() docs:

      Callers of throw_exception are allowed to assume that the
      function never returns; therefore, if the user-defined
      throw_exception returns, the behavior is undefined.

--Beman


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