Common: Enforce explicit handle validation
Some invalid handle values are -1 or INVALID_HANDLE_VALUE, hence our handle template has a specific invalid handle value parameter we should always test against. Time and again, I find my code simply comparing handle against zero. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
3d53fb7b9b
commit
23b856f2e6
@ -914,6 +914,9 @@ namespace winstd
|
|||||||
handle(_In_ const handle<handle_type, INVAL> &h) noexcept {};
|
handle(_In_ const handle<handle_type, INVAL> &h) noexcept {};
|
||||||
handle<handle_type, INVAL>& operator=(_In_ const handle<handle_type, INVAL> &h) noexcept {};
|
handle<handle_type, INVAL>& operator=(_In_ const handle<handle_type, INVAL> &h) noexcept {};
|
||||||
|
|
||||||
|
// Force use of valid() method when testing handle.
|
||||||
|
operator bool() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
/// Attaches already available object handle.
|
/// Attaches already available object handle.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user