Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #401779
| From | fir <profesor.fir@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: why &| dont work and its possible to make it work |
| Date | 2026-09-09 13:28 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <117rftk$13d67$1@dont-email.me> (permalink) |
| References | <117mere$3a14a$1@dont-email.me> <117mm0k$3cu2d$1@dont-email.me> <117r105$r8qb$3@dont-email.me> <117rc2j$11pku$1@dont-email.me> |
bart pisze: > On 09/09/2026 08:14, Lawrence D’Oliveiro wrote: >> On Mon, 7 Sep 2026 16:42:13 +0100, bart wrote: >> >>> I think 'A && B' is equivalent to '(!!A ? 1 : (!!B ? 1 : 0))', if a >>> boolean result is needed. >> >> Why not just >> >> A ? B ? true : false : false > > Yes, that's better, and more correct. I think mine implemented OR not > AND, and I also decided not to test it. > > I used !! because I was aiming towards needing to use & and | but that > didn't happen (!!A & !!B would be non-short-circuiting). > i think probably in simple cases when you dont acll functions etc like if(a<2 & b>7) .. im not sure though but if compiler has optimising block it is rather useles to calc b>7 & probably be short-circuiting anyway > In any case, this is very different from A & B.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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