On 2011-03-14 20:56, Stefan Küng wrote:
> On 12.03.2011 15:00, Oto BREZINA wrote:
>> Have examples if WinAPI (one we talk about here) method addes in Win32
>> with error value not NULL ?
>> I just read some articels about NULL vs. INVALID_HANDLER_VALUE and
>> author states that all new (not existing in WIN16) methods are NULL on
> Not really, no. But I've never heard that INVALID_HANDLE_VALUE is for
> compatibility with 16-bit windows.
Here is one reference however it may reflect opinon of author ...
some mail-list talk about this
> There's already a CHandle class:
Nice - I don't have VC so did not know. I like handle NULL as Invalid
handle more then INVALID_HANdLE_VALUE (-1), simplier test (even not
much). But that would break lot of your code.
This class don't help with dealing with INVALID_HANDLE_VALUE as they
state: If you call an API which can return INVALID_HANDLE_VALUE, you
should check for this value before ... and instead pass NULL.
Using class interface I suggested:
- you can handle NULL as well as INVALD_HANDLE_VALUE as invalid
handle. (not in VC CHandle)
- HANDLE would be closed automaticaly (VC CHandle handle this as well)
- have interface to check valid value without knowing what value it
invalid (not in VC, but not urgent, but MAY improve readability for new
- have HANDLE operatator = (VC too)
- can be extended with refcounting to simplify determining what code
should close handle. BTW: is TSVN multi thread?
If you get interested, we may either derive CHandle or start new one.
CAutoHandle ? CSharedHandle (with refcounting)?
Oto BREZINA, Printflow s.r.o., EU
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2011-03-15 09:34:21 CET