Robert Shearman rob@codeweavers.com writes:
Changelog: Fix sparse warnings.
sparse should be taught that 0 is a perfectly fine value (and IMO preferable to NULL) for handles.
Alexandre Julliard wrote:
Robert Shearman rob@codeweavers.com writes:
Changelog: Fix sparse warnings.
sparse should be taught that 0 is a perfectly fine value (and IMO
Linus wont agree to that. I didn't ask him but seen some of his posts to lklm regarding this matter.
preferable to NULL) for handles.
Rob, I already talked to Alexandre about this at the Wineconf; that's why i didn't send in such a patch.
bye michael
Alexandre Julliard wrote:
Robert Shearman rob@codeweavers.com writes:
Changelog: Fix sparse warnings.
sparse should be taught that 0 is a perfectly fine value (and IMO preferable to NULL) for handles.
I don't really understand this reasoning. Should gcc also be taught not to warn when we try to assign -1 to a handle? Are we using the wrong type for usr_handle_t then?
Rob
Robert Shearman rob@codeweavers.com writes:
Alexandre Julliard wrote:
sparse should be taught that 0 is a perfectly fine value (and IMO preferable to NULL) for handles.
I don't really understand this reasoning. Should gcc also be taught not to warn when we try to assign -1 to a handle? Are we using the wrong type for usr_handle_t then?
In a sense, yes. Handles are conceptually much closer to integers than pointers, but they are pointers in the Windows API so that the different handles can have distinct types. It's really just a workaround for the fact that all integer types are freely interchangeable in C.