I have a question regarding the other question asked on stack overflow:- segmentation fault on c K&R fopen and fillbuf. In this question there is a discussion of flags in struct _iobuf. These are used as different access modes. But down here in enum flags there are are some particular values of flags. So will 'flag' take only these particular values or these are some standard values whereas flag can take some other values as well? My doubt arises from the fact that while defining the array _iob only the three standard values (for stdin, stdout, stderr) were given(out of 20) so the fp can take some other values as well(17 others at the same time). The second doubt is that if flag can take only the defined values like(_READ,_WRITE etc.), then in int _fillbuf() function in place of writing
if((fp->flag & (_READ|_EOF|_ERR))!=_READ)
can we write as
if((fp->flag==_WRITE || fp->flag== _UNBUF))
because out of the given fixed flag values it still makes sense.