Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

I was attacked by dselect as a small child and have since avoided debian. -- Andrew Morton


devel / comp.lang.c / while(T[l]<p & l<=r)

SubjectAuthor
* while(T[l]<p & l<=r)fir
+* Re: while(T[l]<p & l<=r)Janis Papanagnou
|+* Re: while(T[l]<p & l<=r)fir
||`* Re: while(T[l]<p & l<=r)Janis Papanagnou
|| `* Re: while(T[l]<p & l<=r)fir
||  `* Re: while(T[l]<p & l<=r)bart
||   `* Re: while(T[l]<p & l<=r)fir
||    `* Re: while(T[l]<p & l<=r)bart
||     `- Re: while(T[l]<p & l<=r)fir
|+* Re: while(T[l]<p & l<=r)Scott Lurndal
||+* Re: while(T[l]<p & l<=r)David Brown
|||`- Re: while(T[l]<p & l<=r)Kaz Kylheku
||+* Re: while(T[l]<p & l<=r)Tim Rentsch
|||`* Re: while(T[l]<p & l<=r)fir
||| `- Re: while(T[l]<p & l<=r)Tim Rentsch
||`- Re: while(T[l]<p & l<=r)fir
|`- Re: while(T[l]<p & l<=r)Phil Carmody
`* Re: while(T[l]<p & l<=r)Peter 'Shaggy' Haywood
 `- Re: while(T[l]<p & l<=r)fir

1
while(T[l]<p & l<=r)

<uu109u$3798b$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34799&group=comp.lang.c#34799

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: while(T[l]<p & l<=r)
Date: Wed, 27 Mar 2024 12:35:26 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <uu109u$3798b$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 27 Mar 2024 11:35:26 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3384587"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: fir - Wed, 27 Mar 2024 11:35 UTC

tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
i was unable ro remember that

Re: while(T[l]<p & l<=r)

<uu3kqb$3i23g$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34807&group=comp.lang.c#34807

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Thu, 28 Mar 2024 12:37:39 +0100
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <uu3kqb$3i23g$1@dont-email.me>
References: <uu109u$3798b$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 28 Mar 2024 11:37:47 +0100 (CET)
Injection-Info: dont-email.me; posting-host="155435c3f40053ae5c3f5cbd325b2209";
logging-data="3737712"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Ap84ZZuW4eytThbYBR1/Z"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:80+YSfjs/wDZYREPylq20iMA9zY=
In-Reply-To: <uu109u$3798b$1@i2pn2.org>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Thu, 28 Mar 2024 11:37 UTC

On 27.03.2024 12:35, fir wrote:
> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))

1. As long as K&R precedences still hold you don't need the inner
parentheses; '<' and '<=' has higher precedence than '&' and '&&'.
2. In this case where you compare predicate expressions that
evaluate to '0' and '1' on both sides of '&' and '&&' respectively
these expressions are (while not the same) equivalent _here_. If
you don't want to operate on bits but want to express a boolean
conjunction you should use '&&', though.

> i was unable ro remember that

You could look that up if you cannot remember that. Wikipedia[*]
has a page with a lot information, and a concise list you can,
for example, find here:
https://www.cs.uic.edu/~i109/Notes/COperatorPrecedenceTable.pdf

Janis

[*] https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B

Re: while(T[l]<p & l<=r)

<uu3n7d$3aoj9$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34809&group=comp.lang.c#34809

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Thu, 28 Mar 2024 13:18:54 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <uu3n7d$3aoj9$1@i2pn2.org>
References: <uu109u$3798b$1@i2pn2.org> <uu3kqb$3i23g$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 28 Mar 2024 12:18:53 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3498601"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <uu3kqb$3i23g$1@dont-email.me>
 by: fir - Thu, 28 Mar 2024 12:18 UTC

Janis Papanagnou wrote:
> On 27.03.2024 12:35, fir wrote:
>> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
>
> 1. As long as K&R precedences still hold you don't need the inner
> parentheses; '<' and '<=' has higher precedence than '&' and '&&'.
> 2. In this case where you compare predicate expressions that
> evaluate to '0' and '1' on both sides of '&' and '&&' respectively
> these expressions are (while not the same) equivalent _here_. If
> you don't want to operate on bits but want to express a boolean
> conjunction you should use '&&', though.
>

ok tnx much this is quite solid answer

imagine i began to learn c in a week when WTC attack was (maybe like
about wednesday after that if it was friday (im not sure but somethin
about that) and wtill dont memrized those pices - but the answer of the
above is easy to remember "<" stronger than "&"

hovever i wopuld disagre to use "&&" instead "&" then
&& look much worse and probably & has no real disadvantages (i mean no
bigger that the intention that && should be use for boolean - which
probably comes from later c not oryginal young c

so i probably plan to stick to &

>> i was unable ro remember that
>
> You could look that up if you cannot remember that. Wikipedia[*]
> has a page with a lot information, and a concise list you can,
> for example, find here:
> https://www.cs.uic.edu/~i109/Notes/COperatorPrecedenceTable.pdf
>
> Janis
>
> [*] https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B
>

Re: while(T[l]<p & l<=r)

<kXeNN.99578$24ld.63941@fx07.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34815&group=comp.lang.c#34815

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.chmurka.net!weretis.net!feeder8.news.weretis.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!193.141.40.65.MISMATCH!npeer.as286.net!npeer-ng0.as286.net!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx07.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: while(T[l]<p & l<=r)
Newsgroups: comp.lang.c
References: <uu109u$3798b$1@i2pn2.org> <uu3kqb$3i23g$1@dont-email.me>
Lines: 10
Message-ID: <kXeNN.99578$24ld.63941@fx07.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Thu, 28 Mar 2024 14:14:40 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Thu, 28 Mar 2024 14:14:40 GMT
X-Received-Bytes: 1063
 by: Scott Lurndal - Thu, 28 Mar 2024 14:14 UTC

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>On 27.03.2024 12:35, fir wrote:
>> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
>
>1. As long as K&R precedences still hold you don't need the inner
>parentheses; '<' and '<=' has higher precedence than '&' and '&&'.

While true, the parenthesis can be helpful to the reader
and have no adverse effects.

Re: while(T[l]<p & l<=r)

<uu4269$3lf5i$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34818&group=comp.lang.c#34818

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Thu, 28 Mar 2024 16:26:00 +0100
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <uu4269$3lf5i$1@dont-email.me>
References: <uu109u$3798b$1@i2pn2.org> <uu3kqb$3i23g$1@dont-email.me>
<uu3n7d$3aoj9$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 28 Mar 2024 15:26:02 +0100 (CET)
Injection-Info: dont-email.me; posting-host="155435c3f40053ae5c3f5cbd325b2209";
logging-data="3849394"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lgEyRLfSAgzmJaKQ5AXCT"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:3NzJnIVnlMIljc20f1SzGTzUUVI=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <uu3n7d$3aoj9$1@i2pn2.org>
 by: Janis Papanagnou - Thu, 28 Mar 2024 15:26 UTC

On 28.03.2024 13:18, fir wrote:
> Janis Papanagnou wrote:
>> On 27.03.2024 12:35, fir wrote:
>>> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
>>
>> [...] If
>> you don't want to operate on bits but want to express a boolean
>> conjunction you should use '&&', though.
>
> [...]
>
> hovever i wopuld disagre to use "&&" instead "&" then
> && look much worse

(Well, I think that '+' looks much worse than '*', but in
math expressions I use the _appropriate_ operator anyway.)

Mind that '&' is *not* a syntactical variant of '&&'...

> and probably & has no real disadvantages

it is different to '&&', it has another semantic! As said,
it's just by context-coincidence that it's equivalent _here_.

> (i mean no
> bigger that the intention that && should be use for boolean - which
> probably comes from later c not oryginal young c

Original K&R C had '&' for bit-operations and '&&' for boolean
operations.

While, say, 'x<y & u<v' works effectively as 'x<y && u<v' (as
said, because of the evaluations to 0 and 1, general boolean
predicates, like 'p() & q()' is not the same as 'p() && q()',
even if you can use 'p()' and 'q()' in 'if'-conditions as per
the C semantics of booleans (or integers used as booleans).

You often see code like,say, 'x=length(s); y=length(t);' and
compare non-emptiness of the strings with 'if (x)' or with
'if (y)'. If you combine that condition by 'if (x & y)' you
will get wrong results, but 'if (x && y)' would be correct.

'&' is for bit-operations in scalars, '&&' is for booleans
(for logical operations, bool x bool -> bool).

>
> so i probably plan to stick to &

But why stick to a bit-value operator where you want a
boolean logic operator? - You just confuse readers of your
code and unnecessarily introduce error-prone code.

(But you can of course do as you like.)

Janis

Re: while(T[l]<p & l<=r)

<uu45rq$3bcok$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34819&group=comp.lang.c#34819

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Thu, 28 Mar 2024 17:28:41 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <uu45rq$3bcok$1@i2pn2.org>
References: <uu109u$3798b$1@i2pn2.org> <uu3kqb$3i23g$1@dont-email.me> <uu3n7d$3aoj9$1@i2pn2.org> <uu4269$3lf5i$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 28 Mar 2024 16:28:43 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3519252"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <uu4269$3lf5i$1@dont-email.me>
 by: fir - Thu, 28 Mar 2024 16:28 UTC

Janis Papanagnou wrote:
> On 28.03.2024 13:18, fir wrote:
>> Janis Papanagnou wrote:
>>> On 27.03.2024 12:35, fir wrote:
>>>> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
>>>
>>> [...] If
>>> you don't want to operate on bits but want to express a boolean
>>> conjunction you should use '&&', though.
>>
>> [...]
>>
>> hovever i wopuld disagre to use "&&" instead "&" then
>> && look much worse
>
> (Well, I think that '+' looks much worse than '*', but in
> math expressions I use the _appropriate_ operator anyway.)
>
> Mind that '&' is *not* a syntactical variant of '&&'...
>
>> and probably & has no real disadvantages
>
> it is different to '&&', it has another semantic! As said,
> it's just by context-coincidence that it's equivalent _here_.
>
>> (i mean no
>> bigger that the intention that && should be use for boolean - which
>> probably comes from later c not oryginal young c
>
> Original K&R C had '&' for bit-operations and '&&' for boolean
> operations.
>
> While, say, 'x<y & u<v' works effectively as 'x<y && u<v' (as
> said, because of the evaluations to 0 and 1, general boolean
> predicates, like 'p() & q()' is not the same as 'p() && q()',
> even if you can use 'p()' and 'q()' in 'if'-conditions as per
> the C semantics of booleans (or integers used as booleans).
>
> You often see code like,say, 'x=length(s); y=length(t);' and
> compare non-emptiness of the strings with 'if (x)' or with
> 'if (y)'. If you combine that condition by 'if (x & y)' you
> will get wrong results, but 'if (x && y)' would be correct.
>

how, if string ate empty then the pionters are nulls to
null&null should work ok imo

> '&' is for bit-operations in scalars, '&&' is for booleans
> (for logical operations, bool x bool -> bool).
>
>>
>> so i probably plan to stick to &
>
> But why stick to a bit-value operator where you want a
> boolean logic operator? - You just confuse readers of your
> code and unnecessarily introduce error-prone code.
>
> (But you can of course do as you like.)
>
> Janis
>
becouse this && is ugly i think the addition of && is kinda error
in language

Re: while(T[l]<p & l<=r)

<uu46ng$3ml9c$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34820&group=comp.lang.c#34820

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (bart)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Thu, 28 Mar 2024 16:43:28 +0000
Organization: A noiseless patient Spider
Lines: 86
Message-ID: <uu46ng$3ml9c$1@dont-email.me>
References: <uu109u$3798b$1@i2pn2.org> <uu3kqb$3i23g$1@dont-email.me>
<uu3n7d$3aoj9$1@i2pn2.org> <uu4269$3lf5i$1@dont-email.me>
<uu45rq$3bcok$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 28 Mar 2024 16:43:29 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0b002853fa67121678521498ccf04ca5";
logging-data="3888428"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+72JWTN1heBvGSJCWE28fq"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:RccLwuQpp4GLE4FlnzM0tJBBYDg=
Content-Language: en-GB
In-Reply-To: <uu45rq$3bcok$1@i2pn2.org>
 by: bart - Thu, 28 Mar 2024 16:43 UTC

On 28/03/2024 16:28, fir wrote:
> Janis Papanagnou wrote:
>> On 28.03.2024 13:18, fir wrote:
>>> Janis Papanagnou wrote:
>>>> On 27.03.2024 12:35, fir wrote:
>>>>> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
>>>>
>>>> [...] If
>>>> you don't want to operate on bits but want to express a boolean
>>>> conjunction you should use '&&', though.
>>>
>>> [...]
>>>
>>> hovever i wopuld disagre to use "&&" instead "&" then
>>> && look much worse
>>
>> (Well, I think that '+' looks much worse than '*', but in
>> math expressions I use the _appropriate_ operator anyway.)
>>
>> Mind that '&' is *not* a syntactical variant of '&&'...
>>
>>> and probably & has no real disadvantages
>>
>> it is different to '&&', it has another semantic! As said,
>> it's just by context-coincidence that it's equivalent _here_.
>>
>>> (i mean no
>>> bigger that the intention that && should be use for boolean - which
>>> probably comes from later c not oryginal young c
>>
>> Original K&R C had '&' for bit-operations and '&&' for boolean
>> operations.
>>
>> While, say, 'x<y & u<v' works effectively as 'x<y && u<v' (as
>> said, because of the evaluations to 0 and 1, general boolean
>> predicates, like 'p() & q()' is not the same as 'p() && q()',
>> even if you can use 'p()' and 'q()' in 'if'-conditions as per
>> the C semantics of booleans (or integers used as booleans).
>>
>> You often see code like,say, 'x=length(s); y=length(t);' and
>> compare non-emptiness of the strings with 'if (x)' or with
>> 'if (y)'. If you combine that condition by 'if (x & y)' you
>> will get wrong results, but 'if (x && y)' would be correct.
>>
>
> how, if string ate empty then the pionters are nulls to
> null&null should work ok imo

Aren't x and y integers? An empty string is presumably "" (not NULL) and
length("") should be 0.

>> But why stick to a bit-value operator where you want a
>> boolean logic operator? - You just confuse readers of your
>> code and unnecessarily introduce error-prone code.
>>
>> (But you can of course do as you like.)

> becouse this && is ugly i think the addition of && is kinda error
> in language

Of all the ugly things in C, you have to pick on &&? In any case, that's
the correct operator to use here, since && is quite different from &:

if (length(s) & length(t))

if (length(s) && length(t))

Suppose s is "AB" and t is "ABCD". Then the version using & will do 2 &
4 which is zero: so FALSE.

The version using && will be 2 && 4 which is 1, so TRUE, a completely
different result.

Also, if s was "", then the version using && short-circuits, so it won't
bother evaluating length(t); it is more efficient.

Also, as you've discovered, & has a different and less suitable
precedence compared to &&.

If you really hate '&&' then try including <iso646.h>. Now you can do this:

if (length(s) and length(t))

But let me guess; that's too long-winded? 'A and B' instead of 'A&&B'
because 'and' needs that white space.

Re: while(T[l]<p & l<=r)

<uu48e7$3bg7g$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34821&group=comp.lang.c#34821

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Thu, 28 Mar 2024 18:12:44 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <uu48e7$3bg7g$1@i2pn2.org>
References: <uu109u$3798b$1@i2pn2.org> <uu3kqb$3i23g$1@dont-email.me> <uu3n7d$3aoj9$1@i2pn2.org> <uu4269$3lf5i$1@dont-email.me> <uu45rq$3bcok$1@i2pn2.org> <uu46ng$3ml9c$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 28 Mar 2024 17:12:42 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3522800"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
In-Reply-To: <uu46ng$3ml9c$1@dont-email.me>
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: fir - Thu, 28 Mar 2024 17:12 UTC

bart wrote:
> On 28/03/2024 16:28, fir wrote:
>> Janis Papanagnou wrote:
>>> On 28.03.2024 13:18, fir wrote:
>>>> Janis Papanagnou wrote:
>>>>> On 27.03.2024 12:35, fir wrote:
>>>>>> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
>>>>>
>>>>> [...] If
>>>>> you don't want to operate on bits but want to express a boolean
>>>>> conjunction you should use '&&', though.
>>>>
>>>> [...]
>>>>
>>>> hovever i wopuld disagre to use "&&" instead "&" then
>>>> && look much worse
>>>
>>> (Well, I think that '+' looks much worse than '*', but in
>>> math expressions I use the _appropriate_ operator anyway.)
>>>
>>> Mind that '&' is *not* a syntactical variant of '&&'...
>>>
>>>> and probably & has no real disadvantages
>>>
>>> it is different to '&&', it has another semantic! As said,
>>> it's just by context-coincidence that it's equivalent _here_.
>>>
>>>> (i mean no
>>>> bigger that the intention that && should be use for boolean - which
>>>> probably comes from later c not oryginal young c
>>>
>>> Original K&R C had '&' for bit-operations and '&&' for boolean
>>> operations.
>>>
>>> While, say, 'x<y & u<v' works effectively as 'x<y && u<v' (as
>>> said, because of the evaluations to 0 and 1, general boolean
>>> predicates, like 'p() & q()' is not the same as 'p() && q()',
>>> even if you can use 'p()' and 'q()' in 'if'-conditions as per
>>> the C semantics of booleans (or integers used as booleans).
>>>
>>> You often see code like,say, 'x=length(s); y=length(t);' and
>>> compare non-emptiness of the strings with 'if (x)' or with
>>> 'if (y)'. If you combine that condition by 'if (x & y)' you
>>> will get wrong results, but 'if (x && y)' would be correct.
>>>
>>
>> how, if string ate empty then the pionters are nulls to
>> null&null should work ok imo
>
> Aren't x and y integers? An empty string is presumably "" (not NULL) and
> length("") should be 0.
>
>>> But why stick to a bit-value operator where you want a
>>> boolean logic operator? - You just confuse readers of your
>>> code and unnecessarily introduce error-prone code.
>>>
>>> (But you can of course do as you like.)
>
>> becouse this && is ugly i think the addition of && is kinda error
>> in language
>
> Of all the ugly things in C, you have to pick on &&? In any case, that's
> the correct operator to use here, since && is quite different from &:
>
> if (length(s) & length(t))
>
> if (length(s) && length(t))
>
> Suppose s is "AB" and t is "ABCD". Then the version using & will do 2 &
> 4 which is zero: so FALSE.
>
> The version using && will be 2 && 4 which is 1, so TRUE, a completely
> different result.
>
> Also, if s was "", then the version using && short-circuits, so it won't
> bother evaluating length(t); it is more efficient.
>
> Also, as you've discovered, & has a different and less suitable
> precedence compared to &&.
>
>
> If you really hate '&&' then try including <iso646.h>. Now you can do this:
>
> if (length(s) and length(t))
>
> But let me guess; that's too long-winded? 'A and B' instead of 'A&&B'
> because 'and' needs that white space.

should be A&B and everything looks liek it should

thsoe with length are weird programming i dont use it,
using & is not totally proper taking c history but && for me is also not
fully proper taking c 'style' and & i find just better

Re: while(T[l]<p & l<=r)

<uu4bu4$3nrfa$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34824&group=comp.lang.c#34824

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Thu, 28 Mar 2024 19:12:20 +0100
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <uu4bu4$3nrfa$2@dont-email.me>
References: <uu109u$3798b$1@i2pn2.org> <uu3kqb$3i23g$1@dont-email.me>
<kXeNN.99578$24ld.63941@fx07.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 28 Mar 2024 18:12:20 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0a08a487bba2a74163287f88a6183244";
logging-data="3927530"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+uMppjWxU4AvEdVh/yXykSC84E0gQBpW8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:WO1b6q/w9AawRJUYPJPervWVu5o=
In-Reply-To: <kXeNN.99578$24ld.63941@fx07.iad>
Content-Language: en-GB
 by: David Brown - Thu, 28 Mar 2024 18:12 UTC

On 28/03/2024 15:14, Scott Lurndal wrote:
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>> On 27.03.2024 12:35, fir wrote:
>>> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
>>
>> 1. As long as K&R precedences still hold you don't need the inner
>> parentheses; '<' and '<=' has higher precedence than '&' and '&&'.
>
> While true, the parenthesis can be helpful to the reader
> and have no adverse effects.
>

A couple of space characters would also not go amiss in aiding the reader.

Re: while(T[l]<p & l<=r)

<20240328112346.340@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34826&group=comp.lang.c#34826

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Thu, 28 Mar 2024 18:24:45 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <20240328112346.340@kylheku.com>
References: <uu109u$3798b$1@i2pn2.org> <uu3kqb$3i23g$1@dont-email.me>
<kXeNN.99578$24ld.63941@fx07.iad> <uu4bu4$3nrfa$2@dont-email.me>
Injection-Date: Thu, 28 Mar 2024 18:24:46 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0f46c24a0f9f92d710ad763b15b55524";
logging-data="3932016"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+lNOEnmm2lvPKv/xb4KJZT0XyMiDid2t0="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:g0yUbf2xWyNJhhDQNkyF9jCbuao=
 by: Kaz Kylheku - Thu, 28 Mar 2024 18:24 UTC

On 2024-03-28, David Brown <david.brown@hesbynett.no> wrote:
> On 28/03/2024 15:14, Scott Lurndal wrote:
>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>> On 27.03.2024 12:35, fir wrote:
>>>> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
>>>
>>> 1. As long as K&R precedences still hold you don't need the inner
>>> parentheses; '<' and '<=' has higher precedence than '&' and '&&'.
>>
>> While true, the parenthesis can be helpful to the reader
>> and have no adverse effects.
>
> A couple of space characters would also not go amiss in aiding the reader.

But that "fir" *is* a space character.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: while(T[l]<p & l<=r)

<uu4gqv$3p07m$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34828&group=comp.lang.c#34828

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (bart)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Thu, 28 Mar 2024 19:36:00 +0000
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <uu4gqv$3p07m$1@dont-email.me>
References: <uu109u$3798b$1@i2pn2.org> <uu3kqb$3i23g$1@dont-email.me>
<uu3n7d$3aoj9$1@i2pn2.org> <uu4269$3lf5i$1@dont-email.me>
<uu45rq$3bcok$1@i2pn2.org> <uu46ng$3ml9c$1@dont-email.me>
<uu48e7$3bg7g$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 28 Mar 2024 19:36:00 +0100 (CET)
Injection-Info: dont-email.me; posting-host="0b002853fa67121678521498ccf04ca5";
logging-data="3965174"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/odLwR7KNFE7mojBD1epNM"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:dmpFTsa4eulw9NFl7eSxyOk4nGA=
In-Reply-To: <uu48e7$3bg7g$1@i2pn2.org>
Content-Language: en-GB
 by: bart - Thu, 28 Mar 2024 19:36 UTC

On 28/03/2024 17:12, fir wrote:
> bart wrote:

>> Of all the ugly things in C, you have to pick on &&? In any case, that's
>> the correct operator to use here, since && is quite different from &:
>>
>>      if (length(s) & length(t))
>>
>>      if (length(s) && length(t))
>>
>> Suppose s is "AB" and t is "ABCD". Then the version using & will do 2 &
>> 4 which is zero: so FALSE.
>>
>> The version using && will be 2 && 4 which is 1, so TRUE, a completely
>> different result.
>>
>> Also, if s was "", then the version using && short-circuits, so it won't
>> bother evaluating length(t); it is more efficient.
>>
>> Also, as you've discovered, & has a different and less suitable
>> precedence compared to &&.
>>
>>
>> If you really hate '&&' then try including <iso646.h>. Now you can do
>> this:
>>
>>      if (length(s) and length(t))
>>
>> But let me guess; that's too long-winded? 'A and B' instead of 'A&&B'
>> because 'and' needs that white space.
>
> should be A&B and everything looks liek it should

You haven't read my post properly have you?

& and && do quite different things; I listed 3 major ways in which they
differ.

Here's another:

float x=k, y=k;
if (x && y) // this will work as expected
if (x & y) // this won't compile

> thsoe with length are weird programming i dont use it,
> using & is not totally proper taking c history but && for me is also not
> fully proper taking c 'style' and & i find just better

OK. You can make & work a bit like && if you turn:

A && B

where A and B are arbitrary expressions, into:

!!(A) & !!(B)

But you still won't get short-circuit behaviour.

Re: while(T[l]<p & l<=r)

<uu4q1n$3c7nv$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34835&group=comp.lang.c#34835

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Thu, 28 Mar 2024 23:13:06 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <uu4q1n$3c7nv$1@i2pn2.org>
References: <uu109u$3798b$1@i2pn2.org> <uu3kqb$3i23g$1@dont-email.me> <uu3n7d$3aoj9$1@i2pn2.org> <uu4269$3lf5i$1@dont-email.me> <uu45rq$3bcok$1@i2pn2.org> <uu46ng$3ml9c$1@dont-email.me> <uu48e7$3bg7g$1@i2pn2.org> <uu4gqv$3p07m$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 28 Mar 2024 22:13:12 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3546879"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <uu4gqv$3p07m$1@dont-email.me>
 by: fir - Thu, 28 Mar 2024 22:13 UTC

bart wrote:
> On 28/03/2024 17:12, fir wrote:
>> bart wrote:
>
>>> Of all the ugly things in C, you have to pick on &&? In any case, that's
>>> the correct operator to use here, since && is quite different from &:
>>>
>>> if (length(s) & length(t))
>>>
>>> if (length(s) && length(t))
>>>
>>> Suppose s is "AB" and t is "ABCD". Then the version using & will do 2 &
>>> 4 which is zero: so FALSE.
>>>
>>> The version using && will be 2 && 4 which is 1, so TRUE, a completely
>>> different result.
>>>
>>> Also, if s was "", then the version using && short-circuits, so it won't
>>> bother evaluating length(t); it is more efficient.
>>>
>>> Also, as you've discovered, & has a different and less suitable
>>> precedence compared to &&.
>>>
>>>
>>> If you really hate '&&' then try including <iso646.h>. Now you can do
>>> this:
>>>
>>> if (length(s) and length(t))
>>>
>>> But let me guess; that's too long-winded? 'A and B' instead of 'A&&B'
>>> because 'and' needs that white space.
>>
>> should be A&B and everything looks liek it should
>
> You haven't read my post properly have you?
>
> & and && do quite different things; I listed 3 major ways in which they
> differ.
>
> Here's another:
>
> float x=k, y=k;
> if (x && y) // this will work as expected
> if (x & y) // this won't compile
>

i dont use it this way - not this one with length ..literally never used
it this way -

probably all teh usecases i use it the & will fit (not sure though but
this can be seen)

>
>
>> thsoe with length are weird programming i dont use it,
>> using & is not totally proper taking c history but && for me is also
>> not fully proper taking c 'style' and & i find just better
>
> OK. You can make & work a bit like && if you turn:
>
> A && B
>
> where A and B are arbitrary expressions, into:
>
> !!(A) & !!(B)
>
> But you still won't get short-circuit behaviour.
>

Re: while(T[l]<p & l<=r)

<86h6gnipqb.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34873&group=comp.lang.c#34873

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Sat, 30 Mar 2024 10:39:08 -0700
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <86h6gnipqb.fsf@linuxsc.com>
References: <uu109u$3798b$1@i2pn2.org> <uu3kqb$3i23g$1@dont-email.me> <kXeNN.99578$24ld.63941@fx07.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Sat, 30 Mar 2024 17:39:09 +0100 (CET)
Injection-Info: dont-email.me; posting-host="8552662d97416c03078d7b971fbb1163";
logging-data="1197312"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/c07hsso7n7eyvFrdVxSgY5sCFG2EzYB8="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:qrM8wJE67cz8ZtFz2Ka8FOcBYxU=
sha1:WeHO9ZbODRCI8Sp5/IggJySSYgY=
 by: Tim Rentsch - Sat, 30 Mar 2024 17:39 UTC

scott@slp53.sl.home (Scott Lurndal) writes:

> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>
>> On 27.03.2024 12:35, fir wrote:
>>
>>> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
>>
>> 1. As long as K&R precedences still hold you don't need the inner
>> parentheses; '<' and '<=' has higher precedence than '&' and '&&'.
>
> While true, the parenthesis can be helpful to the reader
> and have no adverse effects.

Certainly extra parentheses can be helpful to some readers.

Considered as a question of fact, the proposition that extra
parentheses have no adverse effects is false. It may be the
case that the adverse effects are thought to be unimportant
relative to some proposed benefit, but that is a question of
opinion rather than a question of fact.

Re: while(T[l]<p & l<=r)

<uu9p7m$3icae$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34878&group=comp.lang.c#34878

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Sat, 30 Mar 2024 20:30:03 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <uu9p7m$3icae$1@i2pn2.org>
References: <uu109u$3798b$1@i2pn2.org> <uu3kqb$3i23g$1@dont-email.me> <kXeNN.99578$24ld.63941@fx07.iad> <86h6gnipqb.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 30 Mar 2024 19:29:58 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3748174"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <86h6gnipqb.fsf@linuxsc.com>
 by: fir - Sat, 30 Mar 2024 19:30 UTC

Tim Rentsch wrote:
> scott@slp53.sl.home (Scott Lurndal) writes:
>
>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>
>>> On 27.03.2024 12:35, fir wrote:
>>>
>>>> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
>>>
>>> 1. As long as K&R precedences still hold you don't need the inner
>>> parentheses; '<' and '<=' has higher precedence than '&' and '&&'.
>>
>> While true, the parenthesis can be helpful to the reader
>> and have no adverse effects.
>
> Certainly extra parentheses can be helpful to some readers.
>
> Considered as a question of fact, the proposition that extra
> parentheses have no adverse effects is false. It may be the
> case that the adverse effects are thought to be unimportant
> relative to some proposed benefit, but that is a question of
> opinion rather than a question of fact.
>

what a lamas you are ...

its quite oposite it is using parenthesis and && instead of & and ||
insetad | makes c source code lost its character - its generaly weird
world that i noticed it recenty not 20 years ago

Re: while(T[l]<p & l<=r)

<uubudh$3ktle$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34894&group=comp.lang.c#34894

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Sun, 31 Mar 2024 17:10:47 +0200
Organization: i2pn2 (i2pn.org)
Message-ID: <uubudh$3ktle$1@i2pn2.org>
References: <uu109u$3798b$1@i2pn2.org> <uu3kqb$3i23g$1@dont-email.me> <kXeNN.99578$24ld.63941@fx07.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 31 Mar 2024 15:10:43 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3831470"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <kXeNN.99578$24ld.63941@fx07.iad>
 by: fir - Sun, 31 Mar 2024 15:10 UTC

Scott Lurndal wrote:
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>> On 27.03.2024 12:35, fir wrote:
>>> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
>>
>> 1. As long as K&R precedences still hold you don't need the inner
>> parentheses; '<' and '<=' has higher precedence than '&' and '&&'.
>
> While true, the parenthesis can be helpful to the reader
> and have no adverse effects.
>

i think i will use the rule if the operator precedences are right

(and here ARITHM < REL < LOG rule is ruight) i will not use parenthesis
but when its wrong i will use them (probably even if they are not needed)

if(!(i%16)) for example i must use it becouse if(!i%16) sadly and
unproperly dont work

Re: while(T[l]<p & l<=r)

<3pgudk-e4a.ln1@hendrix.foo>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34910&group=comp.lang.c#34910

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: phayw...@alphalink.com.au (Peter 'Shaggy' Haywood)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Wed, 03 Apr 2024 10:25:55 +1100
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <3pgudk-e4a.ln1@hendrix.foo>
References: <uu109u$3798b$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
Injection-Date: Wed, 03 Apr 2024 13:05:27 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="a90844f993488c887b44df1b05ad9f68";
logging-data="4142820"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/eKKXSbdUTPatz6Gq3f/da+2uHFVaGmiY="
User-Agent: KNode/0.10.9
Cancel-Lock: sha1:7VnDxf17Mxk4fihuudh5MvpugUo=
 by: Peter 'Shaggy&# - Tue, 2 Apr 2024 23:25 UTC

Groovy hepcat fir was jivin' in comp.lang.c on Wed, 27 Mar 2024 10:35
pm. It's a cool scene! Dig it.

> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
> i was unable ro remember that

You're forgetting that && is a so-called "short circuit" operator. If
the left operand is false, then the right operand is not evaluated.
This makes little difference in this particular case; but what if you
had something like this instead?

while(some_function() < p && some_other_function() <= r)

Here some_other_function() will not be called if the some_function()
call returns a value >= p.

--

----- Dig the NEW and IMPROVED news sig!! -----

-------------- Shaggy was here! ---------------
Ain't I'm a dawg!!

Re: while(T[l]<p & l<=r)

<uujpfv$3ulr5$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34911&group=comp.lang.c#34911

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Wed, 03 Apr 2024 16:35:42 +0200
Organization: i2pn2 (i2pn.org)
Message-ID: <uujpfv$3ulr5$1@i2pn2.org>
References: <uu109u$3798b$1@i2pn2.org> <3pgudk-e4a.ln1@hendrix.foo>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 3 Apr 2024 14:35:44 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="4151141"; mail-complaints-to="usenet@i2pn2.org";
posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
In-Reply-To: <3pgudk-e4a.ln1@hendrix.foo>
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: fir - Wed, 3 Apr 2024 14:35 UTC

Peter 'Shaggy' Haywood wrote:
> Groovy hepcat fir was jivin' in comp.lang.c on Wed, 27 Mar 2024 10:35
> pm. It's a cool scene! Dig it.
>
>> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
>> i was unable ro remember that
>
> You're forgetting that && is a so-called "short circuit" operator. If
> the left operand is false, then the right operand is not evaluated.
> This makes little difference in this particular case; but what if you
> had something like this instead?
>
> while(some_function() < p && some_other_function() <= r)
>
> Here some_other_function() will not be called if the some_function()
> call returns a value >= p.
>

okay, good point, need to remember that - but anyway there is a wide
aspect of usecases (roughly 100 procent of mine if im not wrong where
i can replace those poor && and || by really good loking & and |

Re: while(T[l]<p & l<=r)

<86o7aj2kzg.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34980&group=comp.lang.c#34980

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Mon, 08 Apr 2024 21:55:31 -0700
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <86o7aj2kzg.fsf@linuxsc.com>
References: <uu109u$3798b$1@i2pn2.org> <uu3kqb$3i23g$1@dont-email.me> <kXeNN.99578$24ld.63941@fx07.iad> <86h6gnipqb.fsf@linuxsc.com> <uu9p7m$3icae$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Tue, 09 Apr 2024 04:55:32 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="47558c70f7e061adbec47d824d7ff660";
logging-data="40634"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+outj1Cu9YG8yxHM7Nx1T8kE6WBToyguo="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1://ivm69uqL775pkqpMYUJ9clsAI=
sha1:pemVYAQXXGlex0DrzgULdLYYjhM=
 by: Tim Rentsch - Tue, 9 Apr 2024 04:55 UTC

fir <fir@grunge.pl> writes:

> Tim Rentsch wrote:
>
>> scott@slp53.sl.home (Scott Lurndal) writes:
>>
>>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>>
>>>> On 27.03.2024 12:35, fir wrote:
>>>>
>>>>> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
>>>>
>>>> 1. As long as K&R precedences still hold you don't need the inner
>>>> parentheses; '<' and '<=' has higher precedence than '&' and '&&'.
>>>
>>> While true, the parenthesis can be helpful to the reader
>>> and have no adverse effects.
>>
>> Certainly extra parentheses can be helpful to some readers.
>>
>> Considered as a question of fact, the proposition that extra
>> parentheses have no adverse effects is false. It may be the
>> case that the adverse effects are thought to be unimportant
>> relative to some proposed benefit, but that is a question of
>> opinion rather than a question of fact.
>
> what a lamas you are ...
>
> its quite oposite it is using parenthesis and && instead of & and ||
> insetad | makes c source code lost its character - its generaly weird
> world that i noticed it recenty not 20 years ago

Can you explain how your comment has some relationship
to what it was that I said? What is it that you think
I did say?

Re: while(T[l]<p & l<=r)

<875xwj7kiw.fsf@fatphil.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35099&group=comp.lang.c#35099

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: pc+use...@asdf.org (Phil Carmody)
Newsgroups: comp.lang.c
Subject: Re: while(T[l]<p & l<=r)
Date: Sun, 14 Apr 2024 23:32:23 +0300
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <875xwj7kiw.fsf@fatphil.org>
References: <uu109u$3798b$1@i2pn2.org> <uu3kqb$3i23g$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Sun, 14 Apr 2024 22:32:23 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="2ed98d0dc5d7de90f653feab8bc69573";
logging-data="4017667"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19IdNar3Od0QvDOBOERjHu4"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:Np0H1Otm+0yy4rzO4c/8s/XHI5U=
sha1:OncPL44DuWfdsJzWYwc0DWo378k=
 by: Phil Carmody - Sun, 14 Apr 2024 20:32 UTC

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
> On 27.03.2024 12:35, fir wrote:
>> tell me, is while(T[l]<p & l<=r) the same as while((T[l]<p)&&(l<=r))
>
> 1. As long as K&R precedences still hold you don't need the inner
> parentheses; '<' and '<=' has higher precedence than '&' and '&&'.
> 2. In this case where you compare predicate expressions that
> evaluate to '0' and '1' on both sides of '&' and '&&' respectively
> these expressions are (while not the same) equivalent _here_.

The latter has shortcut semantics, and will only evaluate
r, and l a second time, if the first expression is true.
If r or l are memory mapped I/O, or similar, you might be
changing externally visible behaviour.

Phil
--
We are no longer hunters and nomads. No longer awed and frightened, as we have
gained some understanding of the world in which we live. As such, we can cast
aside childish remnants from the dawn of our civilization.
-- NotSanguine on SoylentNews, after Eugen Weber in /The Western Tradition/

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor