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 19 Jul 2017, at 11:21, Christophe Fergeau <cfergeau@xxxxxxxxxx> wrote:

On Wed, Jul 19, 2017 at 10:23:30AM +0200, Christophe de Dinechin wrote:

On 18 Jul 2017, at 17:28, Christophe Fergeau <cfergeau@xxxxxxxxxx> wrote:

On Mon, Jul 17, 2017 at 11:01:22AM +0100, Frediano Ziglio wrote:
Remove CxImage linking.
Support Windows BMP format.

Too bad there is no small/maintained library which would do that for us
:-/ From a quick glance, looks ok.



+static inline size_t compute_dib_stride(unsigned width, unsigned bit_count)

Can you use full type names, unsigned int?

No. Really, no ;-) Otherwise, for consistency, you should replace ‘int’ with ‘signed int’, 

The way I see it, 'signed'/'unsigned' are type modifiers, 'int' is an actual type name.

Yes. But ‘long’ is not. It is also a modifier. So why allow “long” or “short" but not “unsigned”?
Or are you also writing “long int” and “short int”?

Huge difference to me.

No, really not, at least as far as C and usage are concerned. It’s just a personal preference.
So if Frediano prefers to write ‘unsigned’, I think it’s OK, and I will most likely write the same way.


With just "unsigned", which is unusual in the
code I've seen in the past,

It is as customary to write ‘unsigned’ alone as it is to write ‘long’.
In the Linux source code ‘arch’ directory, I find over 2200 occurrences
of ‘unsigned’ not followed by any type. Granted, there are
about 10x as many ‘unsigned int’ and 20 times as many ‘unsigned long’.
But 2200 occurrences show it’s certainly not “unusual".


you cannot guess the range of the values you
can store in there. So let's just be specific.

The language is quite clear that ‘unsigned’ means ‘unsigned int’.
There is no guessing involved whatsoever. The guessing about
the size is because C is not specific about the size of ‘int’ in bits,
which is why we have <stdint.h>.

I think that we can agree that this particular aspect of the C syntax is messy.
That does not mean we have to invent / enforce rules that don’t exist.
Feel free to write ‘unsigned int’ if you want. No reason to force your
personal preference on people who prefer the shorter ‘unsigned’ form.


Christophe


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

_______________________________________________
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]