32 ms·
If it was written "If there does not exist any selected file descriptor where a defined event has occurred", then I'd agree with you. But the way it's actually
by eridius 10y ago
If it was written "If there does not exist any selected file descriptor where a defined event has occurred", then I'd agree with you. But the way it's actually written presupposes that there are selected file descriptors.
- lmm 10y ago> But the way it's actually written presupposes that there are selected file descriptors. How so? It just says "If none of the defined events have occurred on any selected file descriptor, poll() shall wait at least timeout milliseconds for an event to occur on any of the selected file descriptors." "Any selected file descriptor" and "any of the selected file descriptors" make perfect sense for an empty array; nothing written there requires or implies any need for the array to be non-empty.
- eridius 10y agoWe're just going in circles already. It's already been explained that the way the question is written doesn't make sense if there are no file descriptors. I can see why you want to interpret it the way you do, but I don't understand why you refuse to admit that it's possible to read it such that this is undefined behavior.
- lmm 10y agoBecause this stuff is important! Functions that behave inconsistently with empty collections for no reason are a major source of bugs. And if you go as far as undefined behaviour then we're talking not just bugs but security bugs. Words have meanings. The document is supposed to be a specification. I care about having programs that work, and that requires OSes to actually follow the relevant specifications. The document is not ambiguous, there is nothing undefined here; a conforming implementation is clearly required to sleep the specified time when passed 0 fds.
- eridius 10y agoYou keep claiming it's not ambiguous and that nothing is undefined. I've explained repeatedly how the statement can be interpreted such that an empty set is undefined behavior, but you refuse to even acknowledge that this is a potential interpretation of the spec. Yes, the spec should be unambiguous, but that doesn't mean it actually is.
- lmm 10y ago> I've explained repeatedly how the statement can be interpreted such that an empty set is undefined behavior No you haven't. Not at all. Not unless you're claiming the word "any" means something different from what it means.
- eridius 10y agoYes I have. The fact that you seem incapable of understanding this explanation does not mean that I haven't explained it. So please, stop pretending that your viewpoint is the only one that's valid and just accept that there are people who can interpret the wording in a way that you cannot seem to understand.
- lmm 10y agoYou haven't given an explanation. This isn't a question of "viewpoint" or "interpretation". The words simply don't mean what you're trying to claim they do.