[PATCH 2/2] winecoreaudio.drv: Don't print 32-bit values as long integers. (Clang)

Alexandre Julliard julliard at winehq.org
Sat Feb 20 01:27:34 CST 2016


Ken Thomases <ken at codeweavers.com> writes:

> Unfortunately, for historical compatibility reasons, these types are
> defined as (unsigned) long for 32-bit but (unsigned) int for 64-bit.
> So, there's no one correct format specifier.  Well, at least not a
> cross-platform one supported by Wine's logging functions.
>
> I'm ambivalent about using int instead of OSStatus, because I think it
> doesn't make the code significantly more confusing.  However, using
> unsigned int instead of AudioDeviceID seems like it loses important
> semantic information.  It's also likely to backslide as new code is
> written (assuming others habitually follow the API, as I would).
>
> Also, stuff like seen in the hunk above where the type of "devices" is
> changed but the type of "default_id" is not, just because one is used
> in logging and the other is not, is bothersome.  If a new logging
> statement is added that starts logging default_id, will we have to
> change its type?  That's no way to live. ;)
>
> Alexandre, is this really preferable to casting in the logging statements?

Not necessarily. It's a trade-off between using the correct type and
avoiding casts, so it's acceptable to handle AudioDeviceID differently,
if you feel that it's better that way.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list