Claiim/Release Device Vector handle

David J. Ruck druck at druck.org.uk
Thu Jan 3 11:23:15 GMT 2013


On 2 Jan 2013 John Tytgat <John.Tytgat at aaug.net> wrote:

> In message <4796d20753.druck at druck.freeuk.net>
>           "David J. Ruck" <druck at druck.org.uk> wrote:

>> In version 6.70 both (x)os_claim_device_vector and
>> (x)os_release_device_vector took a byte* handle. In version 7.00
>> (x)os_release_device_vector and the _get_handler variants have been
>> changed to take an int handle, but (x)os_release_device_vector is
>> byte* handle as before. It makes more sense for it to be a byte*.

> It's of course not good to have such an inconsistency.

> But currently the 'byte*' (user supplied) handles in OS_Claim, OS_Release,
> OS_CallAfter, OS_CallEvery, OS_RemoveTickerEvent, OS_ChangeEnvironment,
> OS_AddToVector, OS_ReleaseDeviceVector, OS_HeapSort, OS_AddCallBack,
> OS_ReadDefaultHandler, OS_RemoveCallBack, OS_ClaimSWI, OS_ReleaseSWI,
> OS_ClaimOSSWI, ChangeEnvironmentV, Filter_*, ... have the comment
> "//should be int, like other handles" in their .swi files.

> I'm wondering what the origin is of that comment (since r17 in our
> Subversion repository) as the handle type is something the OSLib user
> only knows about so IMHO neither 'byte*' nor 'int' is the right type.
> Perhaps C99's intptr_t would be a better choice.

It would be the most appropriate. But you'll have to see how many 
C/C++ v3 or v4 users squeal if you sneak in a C99 feature!

Cheers
---David

-- 
______________________________________________________________________

David J. Ruck   Phone: +44- (0)7974 108301   Email: druck at druck.org.uk
______________________________________________________________________



More information about the oslib-user mailing list