Article View: comp.lang.c
Article #686Re: why &| dont work and its possible to make it work
From: fir
Date: Thu, 22 Oct 2026 21:13
Date: Thu, 22 Oct 2026 21:13
63 lines
2980 bytes
2980 bytes
Kaz Kylheku pisze:
> 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."
>
sad it not work
overally using this operators is wastefull imo and they not look to much
good
some could for exampl maybe took
if(target<0, target>=bag_max,!bag[target].enabled)
for and or or
or
if any(a,b,c,d) {}
if some(a,b,c) {}
if none(3,b,c,d) {}
eventually if (a,b,c,d) {} for or
coz and can be showed as
if(a) if (b) if(c) if (d) {}
Technical Details
Message-ID:
<11bdu8v$17qlq$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<117mere$3a14a$1@dont-email.me> <11bda5e$vdh3$1@dont-email.me> <%EtCS.3$dnHe.0@fx46.iad> <20261022130030.580@kylheku.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: fir <profesor.fir@gmail.com> Newsgroups: comp.lang.c Subject: Re: why &| dont work and its possible to make it work Date: Thu, 22 Oct 2026 23:13:01 +0200 Organization: A noiseless patient Spider Lines: 63 Message-ID: <11bdu8v$17qlq$1@dont-email.me> References: <117mere$3a14a$1@dont-email.me> <11bda5e$vdh3$1@dont-email.me> <%EtCS.3$dnHe.0@fx46.iad> <20261022130030.580@kylheku.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 22 Oct 2026 21:13:04 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1305274"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+rEQrDz4Y4YFK8DWRYsLXWxTcT2RJUCY0="; posting-host="0b30788676943a83f79a25d06a15ee98" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0 SeaMonkey/2.53.24 Cancel-Lock: sha1:v6hKjgjNdvHkbnaOCdz4B7PXZ4s= sha256:mqF4kPHDVY75usP3emNHetdIBARJpg+nxYjCVRvGU7M= sha1:65r7W1FZMAR6C5drnNPEHjcxVjs= sha256:xxwcKjcgCVRpI/aQWc20TwR6BfIO3tVmXrbpwy3DI4M= In-Reply-To: <20261022130030.580@kylheku.com>