On 2026-09-07, fir <
profesor.fir@gmail.com> wrote:
as i once said i decided to not use && and || as it annoys me (same s == annoys me)
so i will decide to use & | insted but as i not code regullarry today i
not yet maneged to test it throughly when it not work and
if it need big changes in languege to work
i mean one option is that & | should work for BOTH logical and bitwise
The predecessors to the C language had only the bitwise & and | which was
used for testing logical conditions. That's why those operators have
a strangely low precedence.
They work for the purpose, but you have to be fastidiously consistent
about your representation of true; e.g. ensure that true is always 1.
In code like:
if ((status_reg & FOO_MASK) && (io_reg & BAR_MASK)) ..
we cannot blindly replace && with & because status_reg & FOO_MASK
might produce 0x40, and io_reg & BAR_MASK might produce 0x20.
The & and | operators also do not feature left-to-right sequencing.
So we cannot replace && with & in code like
if (ptr != 0 && ptr->foo == bar) ...
Both operands of the & will be evaluated regardless of the value of the
left operand.
--
TXR Programming Language:
http://nongnu.org/txr
Cygnal: Cygwin Native Application Library:
http://kylheku.com/cygnal
Mastodon: @
Kazinator@mstdn.ca
--- PyGate Linux v1.5.19
* Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)