|
Boost : |
Subject: Re: [boost] [iostreams]mapped_file bug on Win32?
From: eg (egoots_at_[hidden])
Date: 2010-02-22 13:42:22
On 2/22/2010 10:28 AM, Nelson, Erik - 2 wrote:
>
> eg wrote:
>
>
>> "If the function fails, the return value is INVALID_SET_FILE_POINTER.
> To get extended error information, call GetLastError."
>
>> if ( dwPtrLow == INVALID_SET_FILE_POINTER&& GetLastError() != NO_ERROR
> )
>
>
> It seems to me that the GetLastError() call as part of the test only
> makes room for problems... The error test is *defined* as
>
> dwPtrLow == INVALID_SET_FILE_POINTER
>
> And the GetLastError() should be called only if an error is detected.
> In fact, if this test had been just the test against
> INVALID_SET_FILE_POINTER, the code would have worked correctly even
> without the SetLastError() clearing the error code.
>
You may be right as I don't see evidence in the docs of a concreted
error case which contradicts this.
However, I am just a little worried about the statement in the docs
which say "If an error has occurred, the return value of SetFilePointer
is INVALID_SET_FILE_POINTER and GetLastError returns a value other than
NO_ERROR."
Perhaps this is just a case of fuzzy documentation, or I am reading too
much into the "...and GetLastError returns a value other than NO_ERROR".
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk