[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: S_IFMT not mentioned in any man page
>>> No new S_IFMT symbolic names for the file type values of mode_t
>>> will be defined by POSIX.1-2008; if new file types are
>>> required, they will only be testable through S_ISxx( ) or
>>> S_TYPEISxxx( ) macros instead.
>> That strikes me as stupid of them. You can't [switch on
> I think most of the time you're interested in one or two specific
(a) That's an artifact of the kind of code you're writing/reading. I'd
estimate my own code that checks filesystem object types is roughly
evenly balanced (say, 1/3 to 2/3) between "check one or maybe two
particular types" and "switch based on type, with at least three
non-default arms in the switch".
(b) Letting "most of the time" drive decisions in ways that leave the
rest of the time out in the cold is a Bad Thing.
> As you say, the problem was possibly the direct access to st_mode,
I don't think I said that. I certainly didn't intend to.
> instead of at some S_FILETYPE(struct stat) or whatever, restricting
> the scope of system library implementors.
It's not much of a restriction; IMO it is outweighed by the things it
allows on the caller side of the API.
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse%rodents-montreal.org@localhost
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
Main Index |
Thread Index |