Re: [PATCHv2] storage_encryption: silence clang warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dave Allan wrote:
...
> It's valid to pass a negative value, so int is the correct type.  My
> bad for using unsigned int in the first place.
>
>>From man printf:
>
> A negative field width is taken as a '-' flag followed by a positive
> field width.

Hi Dave,

While it's true that a negative printf field width has meaning,
this code certainly does not try to take advantage of that.

The *meaning* (as it's used) of that variable is "a non-negative
indentation width".  Hence, the fact that we've chosen a printf-based
implementation to output those spaces is just a detail, and should
not influence the type of the variable.  Nor should it influence the
interfaces through which it is passed.  We could easily switch to a
simple loop, in which case it'd be obvious there's no point in
accepting negative values.

The types used in variables and interfaces should be independent
of such implementation details.

This horse is now officially dead.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]