On Mon, Dec 18, 2000 at 02:33:57PM +0000, Ton Hospel wrote: > In article <20001217162924.E97668@plum.flirble.org>, > Nicholas Clark <nick@ccl4.org> writes: > > static IV > > constant(char *name) > > { > > errno = 0; > > switch (*name) { > > case '_': > > if (strEQ(name, "_S_IFMT")) /* Yes, on name _S_IFMT return S_IFMT. */ > > > > Hey ! what is that evil setting of errno ? I didn't change that. > perl -wle 'use Fcntl; $!=1; print O_NDELAY; print $!' > perl -wle 'use Fcntl; $!=1; print $!' > > That is just sooo wrong ! 5.004 is the earliest perl I have to hand $ /usr/bin/perl-5.004 -wle 'use Fcntl; $!=1; print O_NDELAY; print $!' 2048 $ /usr/bin/perl-5.004 -wle 'use Fcntl; $!=1; print $!' Operation not permitted I think that it has been this way since 5.000, but I can't easily verify. Note, the above doesn't express an opinion about wrongness or rightness. My opinion is to agree that it's wrong. But I am cautious about making changes that would be visible to the program (however trivial) that it may have relied upon. [says he who would like to change the internals of all the maths ops and numeric conversions to like integers] Previous threads about errno setting include one where I said: However, it is irritating when things succeed but set errno. I'm thinking of op/die_exit.t failing under sfio as an example. http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-10/msg00705. and the conclusion of Hugo was It would not be in such a minority: it is quite common for applications to set errno to zero for similar purposes. As has been mentioned, system library calls do not guarantee to preserve errno just because they are successful; I see no benefit to perl offering such a guarantee itself - anyone who needs it can save it easily enough themselves. http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-10/msg00726.html Hugo's position is consistent and well stated. I can't find arguments that would convincingly undermine it. Nicholas ClarkThread Previous | Thread Next