in reply to Is readdir ever deterministic?
As a further point on defensive programming, consider that while some platform may guarantee to return . and .. as the first two entries, they may not guarantee that in the future. If you can make your code more robust in the face of potential future changes at no additional cost, why not do so?
To me, the real point is this: your code should say what you mean. If you intend to exclude . and .., then write that, as shown in your example code. Even if every platform in existence guaranteed the contents of the first two directory entries, IMHO it'd be better to code it as in your example than to eliminate the first two elements and have to explain in a comment what the code is intended to achieve.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Is readdir ever deterministic?
by evlg (Novice) on Sep 17, 2001 at 20:28 UTC |
In Section
Seekers of Perl Wisdom