Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #403455
| From | Kaz Kylheku <046-301-5902@kylheku.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: why &| dont work and its possible to make it work |
| Date | 2026-10-22 20:13 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <20261022130030.580@kylheku.com> (permalink) |
| References | <117mere$3a14a$1@dont-email.me> <11bda5e$vdh3$1@dont-email.me> <%EtCS.3$dnHe.0@fx46.iad> |
On 2026-10-22, Scott Lurndal <scott@slp53.sl.home> wrote:
> fir <profesor.fir@gmail.com> writes:
>>sady this plan of using | & failed becouse its said that here for example
>>
>> if(target<0 ||target>=bag_max ||!bag[target].enabled) {}
>>
>>if target is -1 in case of | the last one will be evalueated too
>>and it may be segfault
>
> If the first test is true, the remaining tests will not be
> executed.
>
> If you knew C, you'd have known that.
Problem is fir said "in case of |"; i.e. "if the operator | is
substituted for || in the above expression".
It's hard to spot things like this in the broken/loose english with low
punctuation and capitalization.
A token substitution in the syntax requiring us to edit, recompile and
redeploy the program image is not exactly a "case"; we normally
don't talk about it that way, let alone as an apparently subordinate
condition to a run time value like target == -1.
"If we change || to | in the above, and then hit the value target == -1
at run-time, then bag[target] is still evaluated, with the out-of-bounds
target index."
--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
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
Re: why &| dont work and its possible to make it work fir <profesor.fir@gmail.com> - 2026-10-22 17:29 +0200
Re: why &| dont work and its possible to make it work scott@slp53.sl.home (Scott Lurndal) - 2026-10-22 19:40 +0000
Re: why &| dont work and its possible to make it work Kaz Kylheku <046-301-5902@kylheku.com> - 2026-10-22 20:13 +0000
Re: why &| dont work and its possible to make it work fir <profesor.fir@gmail.com> - 2026-10-22 23:13 +0200
Re: why &| dont work and its possible to make it work fir <profesor.fir@gmail.com> - 2026-10-22 23:28 +0200
Re: why &| dont work and its possible to make it work fir <profesor.fir@gmail.com> - 2026-10-22 22:46 +0200
Re: why &| dont work and its possible to make it work David Brown <david.brown@hesbynett.no> - 2026-10-23 08:55 +0200
Re: why &| dont work and its possible to make it work fir <profesor.fir@gmail.com> - 2026-10-23 09:39 +0200
Re: why &| dont work and its possible to make it work fir <profesor.fir@gmail.com> - 2026-10-23 09:44 +0200
Re: why &| dont work and its possible to make it work fir <profesor.fir@gmail.com> - 2026-10-23 09:51 +0200
Re: why &| dont work and its possible to make it work David Brown <david.brown@hesbynett.no> - 2026-10-23 11:23 +0200
Re: why &| dont work and its possible to make it work fir <profesor.fir@gmail.com> - 2026-10-23 14:25 +0200
Re: why &| dont work and its possible to make it work "chine.bleu" <chine.bleu@yahoo.com> - 2026-10-24 03:16 -0700
Re: why &| dont work and its possible to make it work fir <profesor.fir@gmail.com> - 2026-10-24 15:00 +0200
Re: why &| dont work and its possible to make it work Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-10-24 22:22 +0000
csiph-web