[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
RE: [ID 20000125.002] Problem in documentation of Fcntl constants
(copy of message that was sent to Tom Christiansen, in reply to his
message...)
OK, I was using "logical OR" as a synomym for "bitwise OR." Anyway, first
of all, addition doesn't work for the Fcntl constants, as I reported a few
minutes ago [ID 20000125.001]. Second, of course I noticed that the flock
bits are powers of two-and was roundly criticized in the newsgroup for
assuming so. And I have to admit it's not good programming practice.
Symbolic constants are not only mnemonic devices, but also
information-hiding devices. And you can't rule out (in principle) multi-bit
constants and/or the programmer's accidental duplication of a constant in
the addition, causing arithmetic carry problems. For the full discussion,
please see the thread beginning 1/19/2000 entitled "Problem with Fcntl
constants."
The point is, a literal reading of the documentation (and isn't that how
it's supposed to be read?) states that integer addition is the proper way to
combine these constants, when in fact not only is it not good practice-but
also just plain doesn't work.
-- Warren
-----Original Message-----
From: Tom Christiansen [mailto:tchrist@chthon.perl.com]
Sent: Tuesday, January 25, 2000 12:31 PM
To: Warren Odom
Cc: perl5-porters@perl.org; tchrist@chthon.perl.com
Subject: Re: [ID 20000125.002] Problem in documentation of Fcntl constants
>After a discussion in the perl.misc newsgroup, everyone agreed that the
>operation should be a logical OR, not an ADD. I'm submitting this as a
>documentation bug, in hopes that this is the appropriate channel to get the
>document changed. In conjunction with the bug in the definition of the
>constants themselves (reported in my previous Email), this caused me
>tremendous problems.
One "adds in" a bit using bitwise OR, not logical OR.
Note also that flock bits are powers of two, which means integer add
and bitwise OR are the same for the domain involved.
--tom
- Follow-Ups from:
-
merlyn@stonehenge.com (Randal L. Schwartz)
- References to:
-
Tom Christiansen <tchrist@chthon.perl.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]