It is roughly equal to this:

void foo(unsigned short int a)
{
   a = (( a & (~0x1F)) | 0x10);
}

It seems to me that the S_* constants should have the same type as mode_t, so 
it's not quite the same...

The "~S_IFMT" is not a constant.

See also 6.3.1 in ISO/IEC 9899 - Programming languages - C, namely "integer 
promotions".

This code will warn also under Linux.

Do you mean the fragment above or the original code? Because the original code 
produces problems only on kFreeBSD, see 
https://buildd.debian.org/status/package.php?p=python-llfuse

The fragment above, because

Linux:    mode_t is unsigned int
FreeBSD:  mode_t is short unsigned int

Again please see "unsigned short" x "signed int".

Or also try to compile with "-Wconversion -Werror" just
**
unsigned short a = ~0x1F;
**

Petr


--
To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/alpine.lrh.2.02.1107162150250.13...@sci.felk.cvut.cz

Reply via email to