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

Re: [PATCH] Fcntl constants speedup

Thread Previous | Thread Next
From:
Karsten Sperling
Date:
December 18, 2000 10:00
Subject:
Re: [PATCH] Fcntl constants speedup
Message ID:
"iraun1.ira.0064701:001218.175949"@ira.uka.de
> 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 $!'
2048

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


- Karsten



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About