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

Re: mode_t bitwise operations different under kFreeBSD?



I assumed that by using mode_t and preprocessor macros, I am working
relatively portable so that I don't have to worry if mode_t is
implemented as unsigned short or signed int.

But you do arithmetic operations on mode_t types.
The ussual C language promotions apply.

Could you maybe just tell me how the code should look like to work on
both Linux and BSD? Hardcoding a numeric literal really doesn't seem
like the proper solution to me...

Just explicitely acknowledge the imlicit conversion:

    __pyx_v_mode = (mode_t)((__pyx_v_mode & (~S_IFMT)) | S_IFDIR);


Petr


Reply to: