Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #401690

Re: why &| dont work and its possible to make it work

From bart <bc@freeuk.com>
Newsgroups comp.lang.c
Subject Re: why &| dont work and its possible to make it work
Date 2026-09-07 16:42 +0100
Organization A noiseless patient Spider
Message-ID <117mm0k$3cu2d$1@dont-email.me> (permalink)
References <117mere$3a14a$1@dont-email.me>

Show all headers | View raw


On 07/09/2026 14:39, fir 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
> 
> is it possible?

No, because they do different things. But if you can only have one, then 
& and | are  more flexible:

I think 'A && B' is equivalent to  '(!!A ? 1 : (!!B ? 1 : 0))', if a 
boolean result is needed.

You can't do '!!A & !!B' because && short-circuits.




> 
> if not i wuld probably suggest using some other methods to make it work 
> (i could eventually say that &| would better work for logical and && || 
> for bitwise but im not saing this becouse it would alos be bad imo)
> so maybe better it should work for both (?)
> 
> if it not brings some problems i suspect something like
> 
> 3&4 has different meaning in logical (1) and bitwise (7) but is that a 
> problem?

Yeah, it's a problem: 3&4 has result 0, but 3&&4 has result 1. But in 
this case, (!!3)&(!!4) can be used to give 1.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

why &| dont work and its possible to make it work fir <profesor.fir@gmail.com> - 2026-09-07 15:39 +0200
  Re: why &| dont work and its possible to make it work bart <bc@freeuk.com> - 2026-09-07 16:42 +0100
    Re: why &| dont work and its possible to make it work fir <profesor.fir@gmail.com> - 2026-09-07 18:14 +0200
    Re: why &| dont work and its possible to make it work Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-09 07:14 +0000
      Re: why &| dont work and its possible to make it work Bonita Montero <Bonita.Montero@gmail.com> - 2026-09-09 11:15 +0200
      Re: why &| dont work and its possible to make it work bart <bc@freeuk.com> - 2026-09-09 11:23 +0100
        Re: why &| dont work and its possible to make it work fir <profesor.fir@gmail.com> - 2026-09-09 13:28 +0200
          Re: why &| dont work and its possible to make it work fir <profesor.fir@gmail.com> - 2026-09-09 14:01 +0200
  Re: why &| dont work and its possible to make it work Bonita Montero <Bonita.Montero@gmail.com> - 2026-09-07 17:49 +0200
    Re: why &| dont work and its possible to make it work fir <profesor.fir@gmail.com> - 2026-09-07 18:22 +0200
    Re: why &| dont work and its possible to make it work Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-09 06:07 +0000
  Re: why &| dont work and its possible to make it work Kaz Kylheku <046-301-5902@kylheku.com> - 2026-09-10 20:13 +0000

csiph-web