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 is the same as bitwise-or'ing those atomic flags).
As far as I understand, I cannot "detect" anything, and such flag cannot be ever set.
A bitwise-and'ed expression like (stat & O_RDONLY) will always be false.
Related:
How to get the mode of a file descriptor? (I asked this)