Re: [vdagent-win PATCH v6 2/5] Initial rewrite of image conversion code

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

 



On Thu, Jul 20, 2017 at 09:42:26AM +0200, Christophe de Dinechin wrote:
> > I moved to "unsigned int" 2 versions ago.
> 
> It was courteous of you.

Yup, thanks, did not take a look at the newer iterations yet.

> 
> > 
> > But still think that is a useful discussion. But honestly I think
> > in this case the readability is quite an opinion and for me
> > unsigned is like long, perfectly readable and I saw lot of code
> > using just unsigned.
> 
> It is useful on two levels:
> 
> a) Because I personally feel ‘unsigned int’ less readable and less
> consistent with the common usage for.’long’ or ‘short’.

Talking about consistency, should why are you using 'int' rather than
'signed' if you prefer using 'unsigned'? Another way of seeing
consistency is:

unsigned long
unsigned short
unsigned int

You've got the unsigned modifier, and then something giving a hint at
the storage size.

Similarly, you have:

long
short
int

and you know these usually are signed.

> 
> b) To discuss the matter of debating style preferences in code reviews,
> notably for new code and new languages.
> 
> In that case, we have C++ code, where my experience tells me that
> ‘unsigned’ is by far more common (as is camel-case, for example).
> 
> If we start considering that some C programmer may not know that
> ‘unsigned’ means ‘unsigned int’, what happens the first time someone
> introduces ‘auto’ or ‘for (a : b) in C++ code, or _Generic in C code?

To reuse your numbers, the usage of unsigned VS unsigned int in arch/ in
the kernel was 90%/10% or even less than that. So yes, it's not unlikely
that someone will never have came across "unsigned", or forgot what it
means, ... _Generic has no trivial equivalent for C code contrary to
"unsigned". Your C++ examples being C++ and not C, I would care less
about C programmers not familiar with C++ ;)

Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]