How to make sense of O_RDONLY = 0?
问题 I am dealing with file status flags. Among test I performed, I found #include <stdio.h> #include "fcntl.h" int main() { const int flag = O_RDONLY; printf( "*** Flag O_RDONLY = %5d\n", flag); return 0; } produces this output *** Flag O_RDONLY = 0 which is fully consistent with #define O_RDONLY 00 from fcntl-linux.h . How can the value zero be used as a flag? I expect an "atomic" flag to be 2^n ( n>=1 ), and "composite" flags (like O_ACCMODE ) to be simply the sum of several atomic flags (which