Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2001-03-21 10:09:06

Dave Abrahams wrote:
> I don't understand your assertion**The OpenClipboard docs,
> for example, seem to put no restriction on which errors can
> be reported.

It does specify under what circumstances the function can fail (ignoring any
kind of misuse), and the only situation when it can happen is "if another
window has the clipboard open", which I consider to be a programmer's error.

> That seems to
> indicate that it can report out-of-memory or any number of
> other errors.

As with any written document, there are several ways to interpret the
platform SDK documentation, and there are a few things one need to know in
order to understand the common interpretation. If you are talking about
"Return Values" clause, then the only thing I can say about it is that it's
pretty much useless for determining the particular function's contract. For
most of Win32 API functions this paragraph is always the same:

  If the function succeeds, the return value is nonzero.
  If the function fails, the return value is zero. To get extended error
information, call GetLastError.

and all it says is that there is no guarantee that the function will never
fail, 'cause user can always misuse it by providing invalid arguments,
calling it at inappropriate time, calling it several times with the same
arguments etc. The real requirements for the function call to be succeeded
(and sources of possible the internal failures), if any, are usually listed
in the "Remarks" section.

> In addition, I would not expect any guarantee that future OS
> versions would limit error returns to reporting usage errors.

Not that I claimed that it is limited to such errors now. I said "given the
calling sequence", and I implied that citied code fragment is the only place
in the system where clipboard is operated by API-level code.


Boost list run by bdawes at, gregod at, cpdaniel at, john at