develooper Front page | perl.perl5.porters | Postings from December 2000

Re: [PATCH] Fcntl constants speedup

Thread Previous | Thread Next
Karsten Sperling
December 18, 2000 10:00
Re: [PATCH] Fcntl constants speedup
Message ID:
> 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.

I wouldn't consider a constant lookup an "operation" in that sense. A
constant lookup is supposed to never ever fail, it's just that, a lookup.
Under no circumstances should it have side effects like resetting errno.
These 3 should all behave the same, but don't:

spiff@uplink:~ > perl -wle 'use Fcntl; $!=1; print O_NDELAY; print $!'

spiff@uplink:~ > perl -wle 'use constant O_NDELAY => 2048; $!=1; print O_NDELAY; print $!'
Die Operation ist nicht erlaubt
spiff@uplink:~ > perl -wle '$!=1; print 2048; print $!'
Die Operation ist nicht erlaubt

- Karsten

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About