On Fri, Jul 21, 2017 at 11:12:13AM +0200, Christophe de Dinechin wrote: > > > On 20 Jul 2017, at 11:23, Christophe Fergeau <cfergeau@xxxxxxxxxx> wrote: > > > > 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’? > > For the same reason that I prefer ‘unsigned’ over ‘unsigned int’ : because > it is the shortest way to express the given type. Remember ‘WET’, > “We Enjoy Typing” ? :-) Ok, in my book, less typing is one of the worst reason one can use as a justification. I like to think code will have many more reads than writes, so making the writer life easier is secondary. Now that this discussion has made me think about it more, I'll consider 'unsigned' as some inconsistent oddity unless the rest of the code base is already using it a lot. > >> 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? > > > > _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++ ;) > > The code under review is C++, isn’t it? I'm answering to something you said which starts with "If we start considering that some C programmer...". And the code under review is more akin to C with classes than C++ to me ;) Christophe
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel