Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Thufir's a Harkonnen now.


devel / comp.lang.c / Re: How About Disallowing Assignments In Expressions?

SubjectAuthor
* How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
+* Re: How About Disallowing Assignments In Expressions?Malcolm McLean
|`* Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| `- Re: How About Disallowing Assignments In Expressions?Tim Rentsch
+- Re: How About Disallowing Assignments In Expressions?Kaz Kylheku
+* Re: How About Disallowing Assignments In Expressions?David Brown
|+* Re: How About Disallowing Assignments In Expressions?Ben Bacarisse
||+* Re: How About Disallowing Assignments In Expressions?Richard Harnden
|||`* Re: How About Disallowing Assignments In Expressions?Ben Bacarisse
||| `* Re: How About Disallowing Assignments In Expressions?Richard Harnden
|||  `* Re: How About Disallowing Assignments In Expressions?Ben Bacarisse
|||   `* Re: How About Disallowing Assignments In Expressions?Malcolm McLean
|||    `* Re: How About Disallowing Assignments In Expressions?Ben Bacarisse
|||     `- Re: How About Disallowing Assignments In Expressions?Malcolm McLean
||`* Re: How About Disallowing Assignments In Expressions?David Brown
|| +* Re: How About Disallowing Assignments In Expressions?Ben Bacarisse
|| |`- Re: How About Disallowing Assignments In Expressions?David Brown
|| `- Re: How About Disallowing Assignments In Expressions?Janis Papanagnou
|+- Re: How About Disallowing Assignments In Expressions?Kaz Kylheku
|`* Re: How About Disallowing Assignments In Expressions?Keith Thompson
| +* Re: How About Disallowing Assignments In Expressions?Malcolm McLean
| |+- Re: How About Disallowing Assignments In Expressions?Keith Thompson
| |`* Re: How About Disallowing Assignments In Expressions?bart
| | +* Re: How About Disallowing Assignments In Expressions?fir
| | |`- Re: How About Disallowing Assignments In Expressions?fir
| | `* Re: How About Disallowing Assignments In Expressions?fir
| |  `* Re: How About Disallowing Assignments In Expressions?fir
| |   +- Re: How About Disallowing Assignments In Expressions?fir
| |   `- Re: How About Disallowing Assignments In Expressions?fir
| +* Re: How About Disallowing Assignments In Expressions?Kaz Kylheku
| |+- Re: How About Disallowing Assignments In Expressions?Keith Thompson
| |`* Re: How About Disallowing Assignments In Expressions?bart
| | +- Re: How About Disallowing Assignments In Expressions?Keith Thompson
| | `- Re: How About Disallowing Assignments In Expressions?Kaz Kylheku
| +- Re: How About Disallowing Assignments In Expressions?David Brown
| +* Re: How About Disallowing Assignments In Expressions?Keith Thompson
| |+- Re: How About Disallowing Assignments In Expressions?fir
| |`* Re: How About Disallowing Assignments In Expressions?Kaz Kylheku
| | `* Re: How About Disallowing Assignments In Expressions?dave thompson 2
| |  +* Re: How About Disallowing Assignments In Expressions?Janis Papanagnou
| |  |`- Re: How About Disallowing Assignments In Expressions?bart
| |  `- Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| +* Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| |+* Re: How About Disallowing Assignments In Expressions?Kaz Kylheku
| ||`* Re: How About Disallowing Assignments In Expressions?David Brown
| || `- Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| |+* Re: How About Disallowing Assignments In Expressions?Keith Thompson
| ||`* Re: How About Disallowing Assignments In Expressions?Keith Thompson
| || `* Re: How About Disallowing Assignments In Expressions?David Brown
| ||  +* Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| ||  |`- Re: How About Disallowing Assignments In Expressions?David Brown
| ||  `- Re: How About Disallowing Assignments In Expressions?Janis Papanagnou
| |`* Re: How About Disallowing Assignments In Expressions?Ben Bacarisse
| | +* Re: How About Disallowing Assignments In Expressions?David Brown
| | |+* Re: How About Disallowing Assignments In Expressions?Ben Bacarisse
| | ||+- Re: How About Disallowing Assignments In Expressions?Ben Bacarisse
| | ||+* Re: How About Disallowing Assignments In Expressions?bart
| | |||`- Re: How About Disallowing Assignments In Expressions?David Brown
| | ||+- Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| | ||`- Re: How About Disallowing Assignments In Expressions?David Brown
| | |`* Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| | | `* Re: How About Disallowing Assignments In Expressions?Ben Bacarisse
| | |  +* Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| | |  |`* Re: How About Disallowing Assignments In Expressions?Keith Thompson
| | |  | `* Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| | |  |  `* Re: How About Disallowing Assignments In Expressions?Keith Thompson
| | |  |   +* Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| | |  |   |`* Re: How About Disallowing Assignments In Expressions?Keith Thompson
| | |  |   | `* Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| | |  |   |  `* Re: How About Disallowing Assignments In Expressions?Keith Thompson
| | |  |   |   +* Re: How About Disallowing Assignments In Expressions?Keith Thompson
| | |  |   |   |`* Re: How About Disallowing Assignments In Expressions?David Brown
| | |  |   |   | `* Re: How About Disallowing Assignments In Expressions?bart
| | |  |   |   |  `* Re: How About Disallowing Assignments In Expressions?David Brown
| | |  |   |   |   +* Re: How About Disallowing Assignments In Expressions?bart
| | |  |   |   |   |`* Re: How About Disallowing Assignments In Expressions?David Brown
| | |  |   |   |   | `- Re: How About Disallowing Assignments In Expressions?Keith Thompson
| | |  |   |   |   `* Re: How About Disallowing Assignments In Expressions?Keith Thompson
| | |  |   |   |    `- Re: How About Disallowing Assignments In Expressions?David Brown
| | |  |   |   `* Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| | |  |   |    +- Re: How About Disallowing Assignments In Expressions?Keith Thompson
| | |  |   |    `* Re: How About Disallowing Assignments In Expressions?David Brown
| | |  |   |     `* Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| | |  |   |      +* Re: How About Disallowing Assignments In Expressions?Keith Thompson
| | |  |   |      |`* Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| | |  |   |      | +- Re: How About Disallowing Assignments In Expressions?Ben Bacarisse
| | |  |   |      | `- Re: How About Disallowing Assignments In Expressions?Keith Thompson
| | |  |   |      `- Re: How About Disallowing Assignments In Expressions?David Brown
| | |  |   `* Re: How About Disallowing Assignments In Expressions?Malcolm McLean
| | |  |    `* Re: How About Disallowing Assignments In Expressions?David Brown
| | |  |     +* Re: How About Disallowing Assignments In Expressions?Malcolm McLean
| | |  |     |`* Re: How About Disallowing Assignments In Expressions?David Brown
| | |  |     | `* Re: How About Disallowing Assignments In Expressions?Malcolm McLean
| | |  |     |  `* Re: How About Disallowing Assignments In Expressions?David Brown
| | |  |     |   `* Re: How About Disallowing Assignments In Expressions?Malcolm McLean
| | |  |     |    `* Re: How About Disallowing Assignments In Expressions?David Brown
| | |  |     |     +* Re: How About Disallowing Assignments In Expressions?Malcolm McLean
| | |  |     |     |`- Re: How About Disallowing Assignments In Expressions?David Brown
| | |  |     |     `* Re: How About Disallowing Assignments In Expressions?bart
| | |  |     |      +- Re: How About Disallowing Assignments In Expressions?Ben Bacarisse
| | |  |     |      `* Re: How About Disallowing Assignments In Expressions?David Brown
| | |  |     +* Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| | |  |     `* Re: How About Disallowing Assignments In Expressions?Janis Papanagnou
| | |  `* Re: How About Disallowing Assignments In Expressions?David Brown
| | +* Re: How About Disallowing Assignments In Expressions?Lawrence D'Oliveiro
| | `- Re: How About Disallowing Assignments In Expressions?Keith Thompson
| +- Re: How About Disallowing Assignments In Expressions?Janis Papanagnou
| `* Re: How About Disallowing Assignments In Expressions?Michael S
+* Re: How About Disallowing Assignments In Expressions?bart
+* Re: How About Disallowing Assignments In Expressions?Blue-Maned_Hawk
+- Re: How About Disallowing Assignments In Expressions?Richard Kettlewell
`* Re: How About Disallowing Assignments In Expressions?Thiago Adams

Pages:123456789101112131415161718192021
Re: Building Code Again

<uqjcg5$2r2ac$4@dont-email.me>

  copy mid

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

  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: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Building Code Again
Date: Wed, 14 Feb 2024 21:48:53 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <uqjcg5$2r2ac$4@dont-email.me>
References: <uq3s76$28dsr$1@dont-email.me> <uq6nha$2spqe$3@dont-email.me>
<87sf20o4e2.fsf@bsb.me.uk> <uq86e9$37s7s$1@dont-email.me>
<uq93m2$3g3f$2@dont-email.me> <8734tzoli4.fsf@bsb.me.uk>
<uq979e$40n1$1@dont-email.me> <87v86vbx6s.fsf@nosuchdomain.example.com>
<uq98lm$40n1$6@dont-email.me> <87il2vbvza.fsf@nosuchdomain.example.com>
<uqau5o$11nm8$1@dont-email.me> <uqauo4$11vps$1@dont-email.me>
<uqb1vc$12k3v$1@dont-email.me> <uqd039$1fnp7$1@dont-email.me>
<uqduum$1mm6v$1@dont-email.me> <uqf801$20hb9$1@dont-email.me>
<uqfd4d$21bu6$1@dont-email.me> <uqfgnv$21tva$1@dont-email.me>
<uqfngh$235bb$1@dont-email.me> <uqft7s$2458n$1@dont-email.me>
<uqg1bv$24to4$1@dont-email.me> <877cj8axo6.fsf@nosuchdomain.example.com>
<uqgs2c$29nvr$1@dont-email.me> <uqhtvp$2ilrc$1@dont-email.me>
<uqi1f2$2j7mt$1@dont-email.me> <uqi3k1$2jhr8$1@dont-email.me>
<uqi886$2kcqi$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 14 Feb 2024 21:48:53 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c31ee10abfacff30964793a7781d00c7";
logging-data="2984268"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ml8hyKGXoNaB0hcNr+lLw"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:T/A0MPPkPhELtVJx/IJbLokF7zU=
 by: Lawrence D'Oliv - Wed, 14 Feb 2024 21:48 UTC

On Wed, 14 Feb 2024 11:30:14 +0000, bart wrote:

> All such choices have a flaw: you need to bundle a binary program to act
> as scripting language ...

There are quite a few scripting languages that are in such common use, it
becomes reasonable that the target system will have these either already
installed, or easily installable. Assuming it is a reasonable type of
target system, with integrated package management.

Re: Building Code Again

<uqjckb$2r2ac$5@dont-email.me>

  copy mid

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

  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: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Building Code Again
Date: Wed, 14 Feb 2024 21:51:07 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <uqjckb$2r2ac$5@dont-email.me>
References: <uq3s76$28dsr$1@dont-email.me> <uq6nha$2spqe$3@dont-email.me>
<87sf20o4e2.fsf@bsb.me.uk> <uq86e9$37s7s$1@dont-email.me>
<uq93m2$3g3f$2@dont-email.me> <8734tzoli4.fsf@bsb.me.uk>
<uq979e$40n1$1@dont-email.me> <87v86vbx6s.fsf@nosuchdomain.example.com>
<uq98lm$40n1$6@dont-email.me> <87il2vbvza.fsf@nosuchdomain.example.com>
<uqau5o$11nm8$1@dont-email.me> <uqauo4$11vps$1@dont-email.me>
<uqb1vc$12k3v$1@dont-email.me> <uqd039$1fnp7$1@dont-email.me>
<uqduum$1mm6v$1@dont-email.me> <uqf801$20hb9$1@dont-email.me>
<uqfd4d$21bu6$1@dont-email.me> <uqfgnv$21tva$1@dont-email.me>
<uqfngh$235bb$1@dont-email.me> <uqft7s$2458n$1@dont-email.me>
<uqg1bv$24to4$1@dont-email.me> <877cj8axo6.fsf@nosuchdomain.example.com>
<uqgs2c$29nvr$1@dont-email.me> <uqhtvp$2ilrc$1@dont-email.me>
<uqi1f2$2j7mt$1@dont-email.me> <uqi3k1$2jhr8$1@dont-email.me>
<uqi886$2kcqi$1@dont-email.me> <20240214141410.00005ea0@yahoo.com>
<uqii13$2m36v$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 14 Feb 2024 21:51:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c31ee10abfacff30964793a7781d00c7";
logging-data="2984268"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+q0Bt8Ltp+Mwzckx7EW89e"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:iPLW24oZOfmHxm4QCbp9osViGAE=
 by: Lawrence D'Oliv - Wed, 14 Feb 2024 21:51 UTC

On Wed, 14 Feb 2024 14:17:07 +0000, bart wrote:

> ... many weren't at all impressed with having
> to type 'gcc prog.c -o prog.exe -O3' when they were used to typing:
>
> make
>
> I began to suspect that some people (not in this group) didn't actually
> know how to build hello.c from a command line.
>
> An analogy would be where I'd reduced the job of installing a kitchen to
> hammering in one nail, but somebody didn't know how to use a hammer.

How about another analogy, where people who are accustomed to cars with
automatic transmissions where you just move the lever to “D” to move off,
and you tell them they have to press the clutch before they can select a
gear.

Re: How About Disallowing Assignments In Expressions?

<BDazN.324763$Wp_8.96522@fx17.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx17.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: How About Disallowing Assignments In Expressions?
Newsgroups: comp.lang.c
References: <uq3s76$28dsr$1@dont-email.me> <uq4nmb$2hive$6@dont-email.me> <87r0hlef8q.fsf@nosuchdomain.example.com> <uq6nha$2spqe$3@dont-email.me> <87sf20o4e2.fsf@bsb.me.uk> <uq8quh$3padl$13@dont-email.me> <uqag7k$v4d8$8@dont-email.me> <uqg4h6$25gc3$1@dont-email.me> <uqg5mn$25m88$1@dont-email.me> <uqh12g$2akab$1@dont-email.me> <87a5o3amit.fsf@nosuchdomain.example.com> <20240214120232.00001d56@yahoo.com> <Bm5zN.88069$GX69.22371@fx46.iad> <871q9f9go2.fsf@nosuchdomain.example.com> <87a5o2lrd2.fsf@bsb.me.uk>
Lines: 60
Message-ID: <BDazN.324763$Wp_8.96522@fx17.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Wed, 14 Feb 2024 21:53:37 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Wed, 14 Feb 2024 21:53:37 GMT
X-Received-Bytes: 3434
 by: Scott Lurndal - Wed, 14 Feb 2024 21:53 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>
>> scott@slp53.sl.home (Scott Lurndal) writes:
>>> Michael S <already5chosen@yahoo.com> writes:
>>>>On Tue, 13 Feb 2024 16:59:38 -0800
>>>>Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>>>> Though personally, I'd probably make the assignment the operand of a
>>>>> larger expression. I understand that
>>>>> if (foo)
>>>>> is a common idiom where foo is of any scalar type, but I personally
>>>>> prefer to write one of
>>>>> if (foo != 0)
>>>>> if (foo != '\0')
>>>>> if (foo != 0.0)
>>>>> if (foo != NULL)
>>>>> because I find it clearer (unless foo is of type bool or is otherwise
>>>>> appropriate to use directly as a condition).
>>>>>
>>>>> Thus if x and y are ints, I'd probably write:
>>>>> if ((x = y) != 0)
>>>>> (Assuming I'm not required to follow MISRA rules.)
>>>>>
>>>>> YMMV.
>>>>>
>>>>
>>>>Agreed with two small exception:
>>>>(1) I never write '\0' myself always preferring plain 0.
>>>
>>> I'm in Keith's camp here when working with a char type, I'll
>>> use '\0' rather than plain zero.
>>>
>>> I tend to suffix constants as well if they're not being
>>> used as 'int', perhaps a bit too picky?
>>>
>>> uint64_t v;
>>> ...
>>> if (v == 0ul) ...
>>
>> There's no suffix for uint64_t. 0ul is of type unsigned long, which may
>> or may not be the same type as uint64_t.
>>
>> In this particular case, I'd just use 0. If for some reason I needed to
>> make it explicitly of type uint64_t (say, for an argument to a variadic
>> function), I'd write `(uint64_t)0`.
>
>stdint.h also provides an UINT64_C(...) macro that could be used,
>though, as you say, 0 is really all that's needed in this case.

OTOH, all the systems the code in question run typedef uint64_t to unsigned
long, so the 'ul' suffix works correctly in all forseeable usages in this
application. And it's less to type than casting. Granted it's not
particularly meaningful in the 0ul case, but it's a habit that does
come in handy in expressions like

uint64_t address;
address = (0xcul << 44) | ((uint64_t)node << 44) | (device << 32) | register_offset;

Yes, a cast on the constant would work as well. And yes, a good compiler
will warn if the suffix is missing from the first constant value.

Re: How About Disallowing Assignments In Expressions?

<sEazN.324764$Wp_8.34532@fx17.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx17.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: How About Disallowing Assignments In Expressions?
Newsgroups: comp.lang.c
References: <uq3s76$28dsr$1@dont-email.me> <uq86e9$37s7s$1@dont-email.me> <uq93m2$3g3f$2@dont-email.me> <8734tzoli4.fsf@bsb.me.uk> <uq979e$40n1$1@dont-email.me> <87v86vbx6s.fsf@nosuchdomain.example.com> <uq98lm$40n1$6@dont-email.me> <87il2vbvza.fsf@nosuchdomain.example.com> <uqau5o$11nm8$1@dont-email.me> <uqauo4$11vps$1@dont-email.me> <uqbrjo$16jcf$6@dont-email.me> <uqg3m0$258lu$5@dont-email.me> <uqgpd1$29928$3@dont-email.me> <87il2s9fdj.fsf@nosuchdomain.example.com> <uqj95e$2qhb1$1@dont-email.me>
Lines: 14
Message-ID: <sEazN.324764$Wp_8.34532@fx17.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Wed, 14 Feb 2024 21:54:32 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Wed, 14 Feb 2024 21:54:32 GMT
X-Received-Bytes: 1500
 by: Scott Lurndal - Wed, 14 Feb 2024 21:54 UTC

Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>On Tue, 13 Feb 2024 14:19:20 -0800, Keith Thompson wrote:
>
>> But C has a *lot* of precedence levels, and they're not all obvious.
>>
>> If I see `a | b ^ c`, I'm not likely to remember off the top of my head
>> ...
>
>So don’t remember “off the top of your head”: keep the docs handy. That’s
>what I do.

Why? The code is easier to read and maintain if the precedence is
made explicit.

Re: How About Disallowing Assignments In Expressions?

<87sf1u8yeu.fsf@nosuchdomain.example.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.nntp4.net!news.gegeweb.eu!gegeweb.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Wed, 14 Feb 2024 14:38:01 -0800
Organization: None to speak of
Lines: 57
Message-ID: <87sf1u8yeu.fsf@nosuchdomain.example.com>
References: <uq3s76$28dsr$1@dont-email.me> <uq4nmb$2hive$6@dont-email.me>
<87r0hlef8q.fsf@nosuchdomain.example.com>
<uq6nha$2spqe$3@dont-email.me> <87sf20o4e2.fsf@bsb.me.uk>
<uq86e9$37s7s$1@dont-email.me> <uq93m2$3g3f$2@dont-email.me>
<8734tzoli4.fsf@bsb.me.uk> <uq979e$40n1$1@dont-email.me>
<87v86vbx6s.fsf@nosuchdomain.example.com>
<uq98lm$40n1$6@dont-email.me>
<87il2vbvza.fsf@nosuchdomain.example.com>
<uq9m1n$bfj9$1@dont-email.me>
<87eddjblyh.fsf@nosuchdomain.example.com>
<uqbrgt$16jcf$5@dont-email.me>
<87bk8m9xzw.fsf@nosuchdomain.example.com>
<uqc4dc$1bn4b$1@dont-email.me> <uqcv3o$1fikf$1@dont-email.me>
<uqjc8o$2r2ac$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="f0324011426819b9e4b7ac5a3d98873d";
logging-data="2999524"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19UoBWNl9IcE6tatAmiI5PD"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:8hdfGQ2vNx0Zxw5oL9FXr0xvy+E=
sha1:3liXma2dBFKaOf6ZOuHQhze4H58=
 by: Keith Thompson - Wed, 14 Feb 2024 22:38 UTC

Lawrence D'Oliveiro <ldo@nz.invalid> writes:
> On Mon, 12 Feb 2024 12:23:35 +0100, David Brown wrote:
>> Do you know what "incompatible types" are, and what they mean? Do you
>> realise that they cannot be swapped around as you suggest?
>
> And yet, all the examples posted so far have involved, not the actual
> types, but pointers to them.

Because pointers to incompatible types are a good way to demonstrate
incompatibility.

Two types can be incompatible even if there are implicit conversions
between them. For example:

int i = 0;
long l = 0;
i = l;
l = i;

This is valid code that does not demonstrate the fact that int and long
are incompatible. But if two types foo and bar are incompatible, then
foo* and bar* are also incompatible *and there are no implicit
conversions between foo* and bar*. That's why the examples use
pointers.

int i = 0;
int *pi = &i;
long l = 0;
long *pl = &l;
i = l; // valid even though int and long are incompatible
pi = pl; // constraint violation because int and long are incompatible

Do you understand that int and long are incompatible even though they're
implicitly convertible, even if they happen to have the same size and
representation? Do you understand what "incompatible types" are? If
not, please consult the standard. If you're using C11 or N1570, start
with section 6.2.7, "Compatible type and composite type" (or the
equivalent subsection in another edition).

Finally, upthread in reponse to Ben's statement:
```
The type of c == d is int, but the value will be either 0 or 1.
```

you wrote:
```
That is the only kind of “boolean” C has.
```

Can you explain exactly what you meant by that? It could easily mean
that you think that int values of 0 and 1 are the only kind of boolean C
has, which is clearly incorrect.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: How About Disallowing Assignments In Expressions?

<87o7ci8xzt.fsf@nosuchdomain.example.com>

  copy mid

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

  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: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Wed, 14 Feb 2024 14:47:02 -0800
Organization: None to speak of
Lines: 46
Message-ID: <87o7ci8xzt.fsf@nosuchdomain.example.com>
References: <uq3s76$28dsr$1@dont-email.me> <uq4nmb$2hive$6@dont-email.me>
<87r0hlef8q.fsf@nosuchdomain.example.com>
<uq6nha$2spqe$3@dont-email.me> <87sf20o4e2.fsf@bsb.me.uk>
<uq8quh$3padl$13@dont-email.me> <uqag7k$v4d8$8@dont-email.me>
<uqg4h6$25gc3$1@dont-email.me> <uqg5mn$25m88$1@dont-email.me>
<uqh12g$2akab$1@dont-email.me>
<87a5o3amit.fsf@nosuchdomain.example.com>
<20240214120232.00001d56@yahoo.com> <Bm5zN.88069$GX69.22371@fx46.iad>
<871q9f9go2.fsf@nosuchdomain.example.com> <87a5o2lrd2.fsf@bsb.me.uk>
<BDazN.324763$Wp_8.96522@fx17.iad>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="f0324011426819b9e4b7ac5a3d98873d";
logging-data="2999524"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18hHwUKsGJZK4R0xeyxZDU3"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:+VdPHQqgkZ3+75Yg0VqifLD78fo=
sha1:vySprvftE+8ZkJjJsjm3AlyZvT8=
 by: Keith Thompson - Wed, 14 Feb 2024 22:47 UTC

scott@slp53.sl.home (Scott Lurndal) writes:
> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>>Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
[...]
>>> There's no suffix for uint64_t. 0ul is of type unsigned long, which may
>>> or may not be the same type as uint64_t.
>>>
>>> In this particular case, I'd just use 0. If for some reason I needed to
>>> make it explicitly of type uint64_t (say, for an argument to a variadic
>>> function), I'd write `(uint64_t)0`.
>>
>>stdint.h also provides an UINT64_C(...) macro that could be used,
>>though, as you say, 0 is really all that's needed in this case.
>
> OTOH, all the systems the code in question run typedef uint64_t to unsigned
> long, so the 'ul' suffix works correctly in all forseeable usages in this
> application. And it's less to type than casting. Granted it's not
> particularly meaningful in the 0ul case, but it's a habit that does
> come in handy in expressions like
>
> uint64_t address;
> address = (0xcul << 44) | ((uint64_t)node << 44) | (device << 32) | register_offset;
>
> Yes, a cast on the constant would work as well. And yes, a good compiler
> will warn if the suffix is missing from the first constant value.

There are certainly systems (including Windows and 32-bit Linux) where
unsigned long is 32 bits. On such systems uint64_t is likely to be
defined as unsigned long long. Even where unsigned long is 64 bits, an
implementation could define uint64_t as unsigned long long.

I think it's a bad idea to make assumptions about which underlying types
are used for the fixed-width types. I might write the above as:

uint64_t address;
address = ((uint64_t)0xc << 44) | ((uint64_t)node << 44) | (device << 32) | register_offset;

(I presume device and register_offset are of type uint64_t.)

I don't think I've ever used the UINT64_C() macro, but that's another
possibility. It's less ugly than the format macros in <inttypes.h>.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: Building Code Again

<uqjo4k$2t0ca$1@dont-email.me>

  copy mid

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

  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: Building Code Again
Date: Thu, 15 Feb 2024 01:07:33 +0000
Organization: A noiseless patient Spider
Lines: 75
Message-ID: <uqjo4k$2t0ca$1@dont-email.me>
References: <uq3s76$28dsr$1@dont-email.me>
<877cj8axo6.fsf@nosuchdomain.example.com> <uqgs2c$29nvr$1@dont-email.me>
<uqhtvp$2ilrc$1@dont-email.me> <uqi1f2$2j7mt$1@dont-email.me>
<uqi3k1$2jhr8$1@dont-email.me> <uqi886$2kcqi$1@dont-email.me>
<20240214141410.00005ea0@yahoo.com> <uqii13$2m36v$1@dont-email.me>
<3v5zN.88071$GX69.76625@fx46.iad> <uqirrb$2o09g$1@dont-email.me>
<Sa7zN.358881$xHn7.264957@fx14.iad> <uqj4ml$2pnqa$1@dont-email.me>
<uqj6iv$2q00f$1@dont-email.me> <uqj9nj$2ql12$1@dont-email.me>
<3yazN.324761$Wp_8.75995@fx17.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 15 Feb 2024 01:07:32 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="02d8ac7ffc12f179390259c847a21c25";
logging-data="3047818"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+UgDRi6lwAwT1Pq/yCDdoZCe2UnbNa1Bc="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:FHMucXNoT+iiuaHYpsZPTIzcDOE=
In-Reply-To: <3yazN.324761$Wp_8.75995@fx17.iad>
Content-Language: en-GB
 by: bart - Thu, 15 Feb 2024 01:07 UTC

On 14/02/2024 21:47, Scott Lurndal wrote:
> bart <bc@freeuk.com> writes:
>> On 14/02/2024 20:07, Richard Harnden wrote:
>
>>> Do you really expect a non-trivial program to consist on only one source
>>> file?  How would that work with many people all working on the some
>>> file?  Merges would be a nightmare.
>>>
>>
>> I don't understand your comment or how it fits in with what I'm saying.
>>
>> NETPPM apparently consists of 100s of small, individual programs. Even
>> SL agreed they were trivial. Many seem to be implemented as a single C
>> file to perform the task.
>>
>> So why can't I compile even one such file?
>
> That is entirely _your_ problem.

Bollocks it is.

Somebody could add even extra layers of pointless complexity to the
build process, but who would notice?

There appears to be nobody in Unix who questions such things; everyone
takes takes at face value. So long as it eventually produces a result,
no matter how long it takes or how torturous the process, nobody cares.

Well, have you considered that that may have alread happened?

> The source is freely available. Why don't you look at it instead
> of complaining about it?

I've spent an hour looking at the 270,000 lines of source code. I was
going to extract bits of to put together one mini app, but I eventually
lost the will to live.

Here, why write one line when half a dozen will do? Why not chain a
dozen function calls needlessly just to make it harder to hunt down the
underlying function? Urghh...

It's not how I'd write it.

> I've never read so many complaints from one person.

Here's a challenge: give me a reason not to complain.

>> What /would/ impress me more is a portable, non-partisan C library that
>> is able to stand by itself with zero dependencies.
>
> Feel free to develop one yourself if you think it is so easy. Make sure
> it builds and functions correctly on all the mainstream operating systems,
> including android, IOS, Linux, Windows and the legacy Unix distributions.

What exactly is it about reading one file and writing another that you
think makes that so challenging? Are you not aware that dealing with
different platforms is the compiler's job?

In any case, I've written so much image-handling stuff that I could do
it in my sleep.

With my current library, inverting an image looks like this when
accessed from scripting code:

a := bmload("test.pgm")
bmsave("itest.pgm", bmneg(a))

I do need help with complex compressed formats like JPG and PNG which
need external support. But those are in hand using C solutions that ARE
more amenable to use. I can pass those through my C compiler to create s
suitable DLL.

Re: Building Code Again

<20240214190516.111@kylheku.com>

  copy mid

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

  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-6894@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: Building Code Again
Date: Thu, 15 Feb 2024 03:08:37 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <20240214190516.111@kylheku.com>
References: <uq3s76$28dsr$1@dont-email.me>
<877cj8axo6.fsf@nosuchdomain.example.com> <uqgs2c$29nvr$1@dont-email.me>
<uqhtvp$2ilrc$1@dont-email.me> <uqi1f2$2j7mt$1@dont-email.me>
<uqi3k1$2jhr8$1@dont-email.me> <uqi886$2kcqi$1@dont-email.me>
<20240214141410.00005ea0@yahoo.com> <uqii13$2m36v$1@dont-email.me>
<3v5zN.88071$GX69.76625@fx46.iad> <uqirrb$2o09g$1@dont-email.me>
<Sa7zN.358881$xHn7.264957@fx14.iad> <uqj4ml$2pnqa$1@dont-email.me>
<uqj6iv$2q00f$1@dont-email.me> <uqj9nj$2ql12$1@dont-email.me>
<3yazN.324761$Wp_8.75995@fx17.iad> <uqjo4k$2t0ca$1@dont-email.me>
Injection-Date: Thu, 15 Feb 2024 03:08:37 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d76b38c2db4f8cfca664aab4bddb4800";
logging-data="3207458"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19rDPjD4Vfhy8xwIGYAYnvkR1hQ+KaHkz4="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:XyeS47t/UoEwzzdMbOFvZCn8P2Y=
 by: Kaz Kylheku - Thu, 15 Feb 2024 03:08 UTC

On 2024-02-15, bart <bc@freeuk.com> wrote:
> There appears to be nobody in Unix who questions such things; everyone
> takes takes at face value. So long as it eventually produces a result,
> no matter how long it takes or how torturous the process, nobody cares.

This is false. There are many critics "in Unix", of Makefiles, GNU
Autotools, the C language including its preprocessing, the shell
language, various utilities, POSIX API's, and almost imaginable element
of the whole cornucopia. Many are well-informed, experienced and have
well-reasoned opinions.

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

Re: How About Disallowing Assignments In Expressions?

<86jzn61ddb.fsf@linuxsc.com>

  copy mid

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

  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.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Wed, 14 Feb 2024 21:54:24 -0800
Organization: A noiseless patient Spider
Lines: 46
Message-ID: <86jzn61ddb.fsf@linuxsc.com>
References: <uq3s76$28dsr$1@dont-email.me> <uq5h7r$2mgb3$2@dont-email.me> <uq5i0r$2mkc4$1@dont-email.me> <uqg5do$25lge$1@dont-email.me> <20240213192257.00002da6@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="d6a0776853173adee93a90f6ecdad10b";
logging-data="3342924"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+fOaw0OSTwrpaR/X9GMrtJh8OVm3Gne6E="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:R6o2onLzXDwze4Wt43tn4ieBuTI=
sha1:EVPgbidpjre+L/pkVnN6wIWKnMc=
 by: Tim Rentsch - Thu, 15 Feb 2024 05:54 UTC

Michael S <already5chosen@yahoo.com> writes:

[.. should 'a += b += c;' be disallowed for style reasons? ..]

> It's actually highly confusing for me as well.
> For reasons I am not fully understand, it is interpreted as
> a += (b += c)
> which is obviously legal.
> I don't understand why it isn't interpreted as
> (a += b) += c
> which is [a little less obviously] illegal.

Here is another way to think about it.

C (and many or most other languages) are fairly strict about what
is allowed on the left-hand side of an assignment. For example,

a + b += c;

is not allowed. Neither is

(a + b) += c;

although the reasoning is a little different in the two cases,
neither is allowed, because neither one makes sense.

By analogy with the second example, the statement

(a += b) += c;

isn't allowed, because the left-hand side is wrong. So if we
see

a += b += c;

it would be silly to parse it as

(a += b) += c;

because that's illegal. The only other way to parse it, viz.,

a += (b += c);

passes the semantic prerequisites. Since it's the only way that
makes sense, it seems natural that (without any parentheses) the
syntax should reflect that.

Re: How About Disallowing Assignments In Expressions?

<86frxu1cww.fsf@linuxsc.com>

  copy mid

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

  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.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Wed, 14 Feb 2024 22:04:15 -0800
Organization: A noiseless patient Spider
Lines: 59
Message-ID: <86frxu1cww.fsf@linuxsc.com>
References: <uq3s76$28dsr$1@dont-email.me> <uq4nmb$2hive$6@dont-email.me> <87r0hlef8q.fsf@nosuchdomain.example.com> <uq6nha$2spqe$3@dont-email.me> <87sf20o4e2.fsf@bsb.me.uk> <uq8quh$3padl$13@dont-email.me> <uqag7k$v4d8$8@dont-email.me> <uqg4h6$25gc3$1@dont-email.me> <uqg5mn$25m88$1@dont-email.me> <uqh12g$2akab$1@dont-email.me> <87a5o3amit.fsf@nosuchdomain.example.com> <20240214120232.00001d56@yahoo.com> <Bm5zN.88069$GX69.22371@fx46.iad> <871q9f9go2.fsf@nosuchdomain.example.com> <87a5o2lrd2.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="d6a0776853173adee93a90f6ecdad10b";
logging-data="3342924"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9r5mMJ9e90hyFs3nJIhCDxIy9xtNDrFU="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:NzAU4ZHMlxVizFrHQkGLHKe0mwI=
sha1:bVaZoXI45uem7he/uICYa2zkHUY=
 by: Tim Rentsch - Thu, 15 Feb 2024 06:04 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>
>> scott@slp53.sl.home (Scott Lurndal) writes:
>>
>>> Michael S <already5chosen@yahoo.com> writes:
>>>
>>>> On Tue, 13 Feb 2024 16:59:38 -0800
>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>>>
>>>>> Though personally, I'd probably make the assignment the operand of a
>>>>> larger expression. I understand that
>>>>> if (foo)
>>>>> is a common idiom where foo is of any scalar type, but I personally
>>>>> prefer to write one of
>>>>> if (foo != 0)
>>>>> if (foo != '\0')
>>>>> if (foo != 0.0)
>>>>> if (foo != NULL)
>>>>> because I find it clearer (unless foo is of type bool or is otherwise
>>>>> appropriate to use directly as a condition).
>>>>>
>>>>> Thus if x and y are ints, I'd probably write:
>>>>> if ((x = y) != 0)
>>>>> (Assuming I'm not required to follow MISRA rules.)
>>>>>
>>>>> YMMV.
>>>>
>>>> Agreed with two small exception:
>>>> (1) I never write '\0' myself always preferring plain 0.
>>>
>>> I'm in Keith's camp here when working with a char type, I'll
>>> use '\0' rather than plain zero.
>>>
>>> I tend to suffix constants as well if they're not being
>>> used as 'int', perhaps a bit too picky?
>>>
>>> uint64_t v;
>>> ...
>>> if (v == 0ul) ...
>>
>> There's no suffix for uint64_t. 0ul is of type unsigned long,
>> which may or may not be the same type as uint64_t.
>>
>> In this particular case, I'd just use 0. If for some reason I
>> needed to make it explicitly of type uint64_t (say, for an argument
>> to a variadic function), I'd write `(uint64_t)0`.
>
> stdint.h also provides an UINT64_C(...) macro that could be used,
> though, as you say, 0 is really all that's needed in this case.

Using UINT64_C(...) to make a constant of type uint64_t is a bit
too sneaky for my taste. Despite what may appear to the be case,
UINT64_C(...) produces a constant of type uint_least64_t, not
uint64_t. Of course if the implementation does have a uint64_t
type, then UINT64_C(...) will have the same width (but not
necessarily the same type) as uint64_t, but the roundabout logic
still bothers me.

Re: How About Disallowing Assignments In Expressions?

<86bk8i1cs8.fsf@linuxsc.com>

  copy mid

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

  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.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Wed, 14 Feb 2024 22:07:03 -0800
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <86bk8i1cs8.fsf@linuxsc.com>
References: <uq3s76$28dsr$1@dont-email.me> <uq4nmb$2hive$6@dont-email.me> <87r0hlef8q.fsf@nosuchdomain.example.com> <uq6nha$2spqe$3@dont-email.me> <87sf20o4e2.fsf@bsb.me.uk> <uq8quh$3padl$13@dont-email.me> <uqag7k$v4d8$8@dont-email.me> <uqg4h6$25gc3$1@dont-email.me> <uqg5mn$25m88$1@dont-email.me> <uqh12g$2akab$1@dont-email.me> <87a5o3amit.fsf@nosuchdomain.example.com> <20240214120232.00001d56@yahoo.com> <Bm5zN.88069$GX69.22371@fx46.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="d6a0776853173adee93a90f6ecdad10b";
logging-data="3342924"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19R7DA6i18wpoA9kKizNRbEAGeFT8SRSg0="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:DfFr2E0XVr5wA4iBDV/kW5qpNvw=
sha1:lITtGxLuok4VIAI7N1mFA/TQ004=
 by: Tim Rentsch - Thu, 15 Feb 2024 06:07 UTC

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

> Michael S <already5chosen@yahoo.com> writes:
>
>> On Tue, 13 Feb 2024 16:59:38 -0800
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>
>
>>>
>>> Though personally, I'd probably make the assignment the operand of a
>>> larger expression. I understand that
>>> if (foo)
>>> is a common idiom where foo is of any scalar type, but I personally
>>> prefer to write one of
>>> if (foo != 0)
>>> if (foo != '\0')
>>> if (foo != 0.0)
>>> if (foo != NULL)
>>> because I find it clearer (unless foo is of type bool or is otherwise
>>> appropriate to use directly as a condition).
>>>
>>> Thus if x and y are ints, I'd probably write:
>>> if ((x = y) != 0)
>>> (Assuming I'm not required to follow MISRA rules.)
>>>
>>> YMMV.
>>
>> Agreed with two small exception:
>> (1) I never write '\0' myself always preferring plain 0.
>
> I'm in Keith's camp here when working with a char type, I'll
> use '\0' rather than plain zero.
>
> I tend to suffix constants as well if they're not being
> used as 'int', perhaps a bit too picky?
>
> uint64_t v;
> ...
> if (v == 0ul) ...

You say what you do but don't say why. Can you explain your
rationale or motivation?

Re: How About Disallowing Assignments In Expressions?

<867cj61ckn.fsf@linuxsc.com>

  copy mid

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

  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.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Wed, 14 Feb 2024 22:11:36 -0800
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <867cj61ckn.fsf@linuxsc.com>
References: <uq3s76$28dsr$1@dont-email.me> <uq4nmb$2hive$6@dont-email.me> <87r0hlef8q.fsf@nosuchdomain.example.com> <uq6nha$2spqe$3@dont-email.me> <87sf20o4e2.fsf@bsb.me.uk> <uq8quh$3padl$13@dont-email.me> <uqag7k$v4d8$8@dont-email.me> <uqg4h6$25gc3$1@dont-email.me> <uqg5mn$25m88$1@dont-email.me> <uqh12g$2akab$1@dont-email.me> <87a5o3amit.fsf@nosuchdomain.example.com> <20240214120232.00001d56@yahoo.com> <Bm5zN.88069$GX69.22371@fx46.iad> <871q9f9go2.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="d6a0776853173adee93a90f6ecdad10b";
logging-data="3342924"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX183t9NZ1R7wTudV109mCfyVokLMTpova9M="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:rE41GYwk0BW0kvpIoOm/CdbyF28=
sha1:Igvv6OFahB7ttCIsWq9YL0+gps4=
 by: Tim Rentsch - Thu, 15 Feb 2024 06:11 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> scott@slp53.sl.home (Scott Lurndal) writes:
>
>> Michael S <already5chosen@yahoo.com> writes:
>>
>>> On Tue, 13 Feb 2024 16:59:38 -0800
>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>>>
>>>> Though personally, I'd probably make the assignment the operand
>>>> of a larger expression. I understand that
>>>> if (foo)
>>>> is a common idiom where foo is of any scalar type, but I
>>>> personally prefer to write one of
>>>> if (foo != 0)
>>>> if (foo != '\0')
>>>> if (foo != 0.0)
>>>> if (foo != NULL)
>>>> because I find it clearer (unless foo is of type bool or is
>>>> otherwise appropriate to use directly as a condition).
>>>>
>>>> Thus if x and y are ints, I'd probably write:
>>>> if ((x = y) != 0)
>>>> (Assuming I'm not required to follow MISRA rules.)
>>>>
>>>> YMMV.
>>>
>>> Agreed with two small exception:
>>> (1) I never write '\0' myself always preferring plain 0.
>>
>> I'm in Keith's camp here when working with a char type, I'll
>> use '\0' rather than plain zero.
>>
>> I tend to suffix constants as well if they're not being
>> used as 'int', perhaps a bit too picky?
>>
>> uint64_t v;
>> ...
>> if (v == 0ul) ...
>
> There's no suffix for uint64_t. 0ul is of type unsigned long,
> which may or may not be the same type as uint64_t.
>
> In this particular case, I'd just use 0. If for some reason I
> needed to make it explicitly of type uint64_t (say, for an
> argument to a variadic function), I'd write `(uint64_t)0`.

Ick. At least write '(uint64_t){ 0 }' rather than casting.

Re: How About Disallowing Assignments In Expressions?

<87jzn68d4s.fsf@nosuchdomain.example.com>

  copy mid

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

  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: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Wed, 14 Feb 2024 22:17:39 -0800
Organization: None to speak of
Lines: 59
Message-ID: <87jzn68d4s.fsf@nosuchdomain.example.com>
References: <uq3s76$28dsr$1@dont-email.me> <uq5h7r$2mgb3$2@dont-email.me>
<uq5i0r$2mkc4$1@dont-email.me> <uqg5do$25lge$1@dont-email.me>
<20240213192257.00002da6@yahoo.com> <86jzn61ddb.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="e5c98b55bbe910135c5e6009c29bfdcf";
logging-data="3346468"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19eHuGWlKP5qtiNCtVQ7bz3"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:QSSQafwYJIkR+ScEtrwULl+1cYI=
sha1:Je5Hiidux9f+5lVHXdnlcjeFx/s=
 by: Keith Thompson - Thu, 15 Feb 2024 06:17 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> Michael S <already5chosen@yahoo.com> writes:
[...]
> Here is another way to think about it.
>
> C (and many or most other languages) are fairly strict about what
> is allowed on the left-hand side of an assignment. For example,
>
> a + b += c;
>
> is not allowed. Neither is
>
> (a + b) += c;
>
> although the reasoning is a little different in the two cases,
> neither is allowed, because neither one makes sense.
>
> By analogy with the second example, the statement
>
> (a += b) += c;
>
> isn't allowed, because the left-hand side is wrong. So if we
> see
>
> a += b += c;
>
> it would be silly to parse it as
>
> (a += b) += c;
>
> because that's illegal. The only other way to parse it, viz.,
>
> a += (b += c);
>
> passes the semantic prerequisites. Since it's the only way that
> makes sense, it seems natural that (without any parentheses) the
> syntax should reflect that.

I don't think that reasoning is entirely solid.

The same reasoning might imply that because x+++++y is legal only if
it's parsed as x++ + ++y, then it makes sense for the syntax to reflect
that. But in fact the syntax isn't defined that way, and x+++++y is a
syntax error (parsed as x ++ ++ + y).

a += b += c parses the way it does because of the way the syntax is
defined, with assignment associating right-to-left. It needn't have
been defined that way, and if assignment associated left-to-right it
would require parentheses to make it valid. In such a hypothetical
not-quite-C language, parsing a += b += c as (a += b) += c would not be
at all silly.

It's true (I think) that assignment associates right-to-left because
that's more convenient.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: How About Disallowing Assignments In Expressions?

<87bk8i8ci1.fsf@nosuchdomain.example.com>

  copy mid

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

  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: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Wed, 14 Feb 2024 22:31:18 -0800
Organization: None to speak of
Lines: 15
Message-ID: <87bk8i8ci1.fsf@nosuchdomain.example.com>
References: <uq3s76$28dsr$1@dont-email.me> <uq4nmb$2hive$6@dont-email.me>
<87r0hlef8q.fsf@nosuchdomain.example.com>
<uq6nha$2spqe$3@dont-email.me> <87sf20o4e2.fsf@bsb.me.uk>
<uq8quh$3padl$13@dont-email.me> <uqag7k$v4d8$8@dont-email.me>
<uqg4h6$25gc3$1@dont-email.me> <uqg5mn$25m88$1@dont-email.me>
<uqh12g$2akab$1@dont-email.me>
<87a5o3amit.fsf@nosuchdomain.example.com>
<20240214120232.00001d56@yahoo.com> <Bm5zN.88069$GX69.22371@fx46.iad>
<871q9f9go2.fsf@nosuchdomain.example.com> <867cj61ckn.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="e5c98b55bbe910135c5e6009c29bfdcf";
logging-data="3346468"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Hbc4DrXg4qKJng3ZdhjPA"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:qWQ+rsxZHCsR8W8cBPtOmmB3cNk=
sha1:zyXi1TajTT/D9WXY8Av90Ha1bUk=
 by: Keith Thompson - Thu, 15 Feb 2024 06:31 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
[...]
>> In this particular case, I'd just use 0. If for some reason I
>> needed to make it explicitly of type uint64_t (say, for an
>> argument to a variadic function), I'd write `(uint64_t)0`.
>
> Ick. At least write '(uint64_t){ 0 }' rather than casting.

Why?

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */

Re: How About Disallowing Assignments In Expressions?

<86wmr6z0zg.fsf@linuxsc.com>

  copy mid

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

  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.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Wed, 14 Feb 2024 22:37:55 -0800
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <86wmr6z0zg.fsf@linuxsc.com>
References: <uq3s76$28dsr$1@dont-email.me> <uq86e9$37s7s$1@dont-email.me> <uq93m2$3g3f$2@dont-email.me> <8734tzoli4.fsf@bsb.me.uk> <uq979e$40n1$1@dont-email.me> <87v86vbx6s.fsf@nosuchdomain.example.com> <uq98lm$40n1$6@dont-email.me> <87il2vbvza.fsf@nosuchdomain.example.com> <uqau5o$11nm8$1@dont-email.me> <uqauo4$11vps$1@dont-email.me> <uqbrjo$16jcf$6@dont-email.me> <uqg3m0$258lu$5@dont-email.me> <uqgpd1$29928$3@dont-email.me> <87il2s9fdj.fsf@nosuchdomain.example.com> <uqj95e$2qhb1$1@dont-email.me> <sEazN.324764$Wp_8.34532@fx17.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="d6a0776853173adee93a90f6ecdad10b";
logging-data="3354661"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18PnqCMGrEXOD+amegFaJHMAPfGcWT/KqE="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:JXhizZBIvuEiM5mA4VJmARlYQL4=
sha1:30b7Erv4ZSIEhnYZHgOs94uq358=
 by: Tim Rentsch - Thu, 15 Feb 2024 06:37 UTC

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

> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>
>> On Tue, 13 Feb 2024 14:19:20 -0800, Keith Thompson wrote:
>>
>>> But C has a *lot* of precedence levels, and they're not all
>>> obvious.
>>>
>>> If I see `a | b ^ c`, I'm not likely to remember off the top of my
>>> head ...
>>
>> So don't remember off the top of your head, [just] keep the docs
>> handy. That's what I do.
>
> Why? The code is easier to read and maintain if the precedence is
> made explicit.

Every serious C developer should know all the operator precedence
relationships without having to look them up.

In cases where it is still felt necessary to indicate how different
operators parse with respect to one another, it's better to do that
using spacing than with parentheses, as for example

a | b^c

or

alpha | beta ^ gamma

[OT] Pascal and popularity (was Re: How About Disallowing Assignments In Expressions?)

<uqkceb$36go3$1@dont-email.me>

  copy mid

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

  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_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.c
Subject: [OT] Pascal and popularity (was Re: How About Disallowing Assignments
In Expressions?)
Date: Thu, 15 Feb 2024 07:54:01 +0100
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <uqkceb$36go3$1@dont-email.me>
References: <uq3s76$28dsr$1@dont-email.me> <uq4nmb$2hive$6@dont-email.me>
<87r0hlef8q.fsf@nosuchdomain.example.com> <uq6nha$2spqe$3@dont-email.me>
<87sf20o4e2.fsf@bsb.me.uk> <uq86e9$37s7s$1@dont-email.me>
<uq93m2$3g3f$2@dont-email.me> <8734tzoli4.fsf@bsb.me.uk>
<uq979e$40n1$1@dont-email.me> <87v86vbx6s.fsf@nosuchdomain.example.com>
<uq98lm$40n1$6@dont-email.me> <87il2vbvza.fsf@nosuchdomain.example.com>
<uqau5o$11nm8$1@dont-email.me> <uqauo4$11vps$1@dont-email.me>
<uqg3dk$258lu$4@dont-email.me> <uqg4f3$25dn5$1@dont-email.me>
<uqgutd$2a91g$1@dont-email.me> <uqhule$2ilrc$2@dont-email.me>
<uqibhb$2kut0$1@dont-email.me> <uqiinc$2m4rb$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 15 Feb 2024 06:54:03 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6426f0312dfca498bcdeeae81ef66c05";
logging-data="3359491"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+axdm1Miu6A9SAtiEu4K7m"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:lmxnU4g/NnZD8BUkWQgHqi3yOGM=
In-Reply-To: <uqiinc$2m4rb$1@dont-email.me>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Thu, 15 Feb 2024 06:54 UTC

On 14.02.2024 15:29, David Brown wrote:
> On 14/02/2024 13:26, Janis Papanagnou wrote:
>> On 14.02.2024 09:46, David Brown wrote:
>>>
>>> I hadn't done much with C++ before then. At that time, most of my
>>> professional programming was in assembly (on small microcontrollers) and
>>> Pascal, with only some C.
>>
>> I'm surprised that Pascal was in professional use back then.[*]
>> Pascal had always been derided as "academic" or "toy" language.
>
> In the DOS/Windows world, Pascal was a major language for a long time -
> starting with Turbo Pascal, then Borland Pascal for DOS then Windows,
> then Delphi. Delphi's descendants are still in heavy use for Windows
> development. (And dotnet came from Delphi and related projects.)

Yes, I'm aware of the "popularity" (as Michael called it) of especially
the Turbo and Borland Pascal dialects [on DOS]. Being platform specific
(for a "personal computer" platform) and being dialects they have never
really been an option for our usage; popularity in general - and surely
in DOS contexts! - was never a criterion for us. (Using standards was,
though!) Yet, beyond popularity on DOS, I haven't heared much about it.
Other languages of the Pascal languages branch, like Ada, certainly had
their professional application areas (in aeronautics, for example)! But
Pascal?

Janis

Re: How About Disallowing Assignments In Expressions?

<uqkcph$36i3s$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.furie.org.uk!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Thu, 15 Feb 2024 08:00:00 +0100
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <uqkcph$36i3s$1@dont-email.me>
References: <uq3s76$28dsr$1@dont-email.me> <uq4nmb$2hive$6@dont-email.me>
<87r0hlef8q.fsf@nosuchdomain.example.com> <uq6nha$2spqe$3@dont-email.me>
<87sf20o4e2.fsf@bsb.me.uk> <uq86e9$37s7s$1@dont-email.me>
<uq93m2$3g3f$2@dont-email.me> <8734tzoli4.fsf@bsb.me.uk>
<uq979e$40n1$1@dont-email.me> <87v86vbx6s.fsf@nosuchdomain.example.com>
<uq98lm$40n1$6@dont-email.me> <87il2vbvza.fsf@nosuchdomain.example.com>
<uqau5o$11nm8$1@dont-email.me> <uqauo4$11vps$1@dont-email.me>
<uqbrjo$16jcf$6@dont-email.me> <uqg3m0$258lu$5@dont-email.me>
<uqgpd1$29928$3@dont-email.me> <uqgtcs$2a1g3$1@dont-email.me>
<uqj976$2qhb1$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 15 Feb 2024 07:00:01 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6426f0312dfca498bcdeeae81ef66c05";
logging-data="3360892"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ebayM2o10ok4xUnX8xqaI"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:SxjkzNC/lHMeLum8Y+VEPZ2yfQo=
In-Reply-To: <uqj976$2qhb1$2@dont-email.me>
 by: Janis Papanagnou - Thu, 15 Feb 2024 07:00 UTC

On 14.02.2024 21:52, Lawrence D'Oliveiro wrote:
> On Wed, 14 Feb 2024 00:18:50 +0100, Janis Papanagnou wrote:
>
>> Though most precedence rules in C make parenthesis usually unnecessary
>> and expressions rarely need parenthesis to provide that certainty.
>
> And yet you were the one who added unnecessary ones in your example, I
> didn’t.

Yes, and I explained that with the given rules you have no "clutter"
(as you called it), so that you can use them even if [by precedence]
unnecessary, to make (a few) specific contexts _clearer_ (i.e. the
opposite of clutter).

Janis

Re: How About Disallowing Assignments In Expressions?

<uqke4u$36p8j$1@dont-email.me>

  copy mid

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

  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_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Thu, 15 Feb 2024 08:23:09 +0100
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <uqke4u$36p8j$1@dont-email.me>
References: <uq3s76$28dsr$1@dont-email.me> <uq6nha$2spqe$3@dont-email.me>
<87sf20o4e2.fsf@bsb.me.uk> <uq86e9$37s7s$1@dont-email.me>
<uq93m2$3g3f$2@dont-email.me> <8734tzoli4.fsf@bsb.me.uk>
<uq979e$40n1$1@dont-email.me> <87v86vbx6s.fsf@nosuchdomain.example.com>
<uq98lm$40n1$6@dont-email.me> <87il2vbvza.fsf@nosuchdomain.example.com>
<uqau5o$11nm8$1@dont-email.me> <uqauo4$11vps$1@dont-email.me>
<uqb1vc$12k3v$1@dont-email.me> <uqd039$1fnp7$1@dont-email.me>
<uqduum$1mm6v$1@dont-email.me> <uqf801$20hb9$1@dont-email.me>
<uqfd4d$21bu6$1@dont-email.me> <uqfgnv$21tva$1@dont-email.me>
<uqfngh$235bb$1@dont-email.me> <uqft7s$2458n$1@dont-email.me>
<uqg1bv$24to4$1@dont-email.me> <877cj8axo6.fsf@nosuchdomain.example.com>
<uqgs2c$29nvr$1@dont-email.me> <uqhtvp$2ilrc$1@dont-email.me>
<uqi1f2$2j7mt$1@dont-email.me> <uqi3k1$2jhr8$1@dont-email.me>
<uqi5gs$2jtp3$1@dont-email.me> <uqibtl$2l0v9$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 15 Feb 2024 07:23:10 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="468c1ac61ae99b2609fe4fe0cf7d46b9";
logging-data="3368211"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+bZHRpMpmOD8Z55njKDwyq"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:PcLy5RixIth5qTFl8mnCd8/b83w=
In-Reply-To: <uqibtl$2l0v9$1@dont-email.me>
 by: Janis Papanagnou - Thu, 15 Feb 2024 07:23 UTC

On 14.02.2024 13:32, David Brown wrote:
> On 14/02/2024 11:43, Malcolm McLean wrote:
>
>> The whole point of using C s to get away from the ad hoc scripting
>> language that you don't use frequently enough to remember exactly how
>> it works, and to use something familiar. So we do want a C
>> interpreter, not a "C-like interpreter" to add yet another language
>> with its own quirks to the mess which Bart has so correctly identiifed.
>
> Please stop using the "royal we" to mean you, personally. If there were
> many people wanting C interpreters for writing scripts, there would be
> lots of C interpreters and lots of scripts written in C. The reality is
> that there is one dead project, and there's tcc's script mode - but I
> have never heard of it being used in practice. Meanwhile, there are
> vast numbers of C programmers, and vast amounts of scripts written in
> Bash, Perl, Python, TCL, and other languages suitable for scripting.
> That should be a good indication that few people feel the need for
> writing scripts in C, even if they are familiar with C.

It's worth to add Awk to your list of script languages, since it's
standard on Unix, and its syntax largely resembles the syntax of C.

Janis

Re: How About Disallowing Assignments In Expressions?

<uqkiib$379pl$3@dont-email.me>

  copy mid

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

  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: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Thu, 15 Feb 2024 08:38:36 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <uqkiib$379pl$3@dont-email.me>
References: <uq3s76$28dsr$1@dont-email.me> <uq4nmb$2hive$6@dont-email.me>
<87r0hlef8q.fsf@nosuchdomain.example.com>
<20240213182331.000024c3@yahoo.com> <YjNyN.446026$83n7.426519@fx18.iad>
<20240213194114.00000fc3@yahoo.com>
<87v86s9i49.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 15 Feb 2024 08:38:36 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="06d12749e5def29a78db342a8b927267";
logging-data="3385141"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19DjGK/HiXLGFFGuytWrEsK"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:81/UWopp3Jt1TMOqctkzaxYmnWQ=
 by: Lawrence D'Oliv - Thu, 15 Feb 2024 08:38 UTC

On Tue, 13 Feb 2024 13:20:06 -0800, Keith Thompson wrote:

> Early Unix did have some methods for accomodating
> upper-case-only keyboards, some of which survive to the present.

As I recall, if you typed your username all in uppercase when logging in,
the login (getty?) program set a terminal mode that converted all
uppercase to lowercase on input, and all lowercase to uppercase on output.

Sort of a “passive-aggressive” case-conversion mode, if you like ...

Re: How About Disallowing Assignments In Expressions?

<uqkios$379pl$4@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.furie.org.uk!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Thu, 15 Feb 2024 08:42:04 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <uqkios$379pl$4@dont-email.me>
References: <uq3s76$28dsr$1@dont-email.me> <uq4nmb$2hive$6@dont-email.me>
<87r0hlef8q.fsf@nosuchdomain.example.com> <uq6nha$2spqe$3@dont-email.me>
<87sf20o4e2.fsf@bsb.me.uk> <uq8quh$3padl$13@dont-email.me>
<uqag7k$v4d8$8@dont-email.me> <uqg4h6$25gc3$1@dont-email.me>
<uqg5mn$25m88$1@dont-email.me> <uqh12g$2akab$1@dont-email.me>
<87a5o3amit.fsf@nosuchdomain.example.com>
<20240214120232.00001d56@yahoo.com> <Bm5zN.88069$GX69.22371@fx46.iad>
<871q9f9go2.fsf@nosuchdomain.example.com> <87a5o2lrd2.fsf@bsb.me.uk>
<BDazN.324763$Wp_8.96522@fx17.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 15 Feb 2024 08:42:04 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="06d12749e5def29a78db342a8b927267";
logging-data="3385141"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/yPtxluN7rb/UvJADlgXxC"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:igfAsmb5R/W/Gs0agefvHNKQueI=
 by: Lawrence D'Oliv - Thu, 15 Feb 2024 08:42 UTC

On Wed, 14 Feb 2024 21:53:37 GMT, Scott Lurndal wrote:

> address = (0xcul << 44) | ((uint64_t)node << 44) | (device << 32) | register_offset;

I did say parenthesis clutter seemed to be a common affliction among C
programmers, didn’t I?

address = 0xcul << 44 | (uint64_t)node << 44 | device << 32 | register_offset;

Re: How About Disallowing Assignments In Expressions?

<uqkir4$379pl$5@dont-email.me>

  copy mid

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

  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: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Thu, 15 Feb 2024 08:43:16 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <uqkir4$379pl$5@dont-email.me>
References: <uq3s76$28dsr$1@dont-email.me> <uq4nmb$2hive$6@dont-email.me>
<87r0hlef8q.fsf@nosuchdomain.example.com> <uq6nha$2spqe$3@dont-email.me>
<87sf20o4e2.fsf@bsb.me.uk> <uq86e9$37s7s$1@dont-email.me>
<uq93m2$3g3f$2@dont-email.me> <8734tzoli4.fsf@bsb.me.uk>
<uq979e$40n1$1@dont-email.me> <87v86vbx6s.fsf@nosuchdomain.example.com>
<uq98lm$40n1$6@dont-email.me> <87il2vbvza.fsf@nosuchdomain.example.com>
<uq9m1n$bfj9$1@dont-email.me> <87eddjblyh.fsf@nosuchdomain.example.com>
<uqbrgt$16jcf$5@dont-email.me> <87bk8m9xzw.fsf@nosuchdomain.example.com>
<uqc4dc$1bn4b$1@dont-email.me> <uqcv3o$1fikf$1@dont-email.me>
<uqjc8o$2r2ac$3@dont-email.me> <87sf1u8yeu.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 15 Feb 2024 08:43:16 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="06d12749e5def29a78db342a8b927267";
logging-data="3385141"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+U0Trk4EtDe+7nyXxwuwxW"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:vvtntvphDc8HpOhf22wKGoTBulg=
 by: Lawrence D'Oliv - Thu, 15 Feb 2024 08:43 UTC

On Wed, 14 Feb 2024 14:38:01 -0800, Keith Thompson wrote:

> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>
>> And yet, all the examples posted so far have involved, not the actual
>> types, but pointers to them.
>
> Because pointers to incompatible types are a good way to demonstrate
> incompatibility.

But it was those types I was talking about, not pointers to them.

Re: How About Disallowing Assignments In Expressions?

<uqkj2i$379pl$6@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.samoylyk.net!news.szaf.org!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Thu, 15 Feb 2024 08:47:14 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <uqkj2i$379pl$6@dont-email.me>
References: <uq3s76$28dsr$1@dont-email.me> <uq4nmb$2hive$6@dont-email.me>
<87r0hlef8q.fsf@nosuchdomain.example.com> <uq6nha$2spqe$3@dont-email.me>
<87sf20o4e2.fsf@bsb.me.uk> <uq86e9$37s7s$1@dont-email.me>
<uq93m2$3g3f$2@dont-email.me> <8734tzoli4.fsf@bsb.me.uk>
<uq979e$40n1$1@dont-email.me> <87v86vbx6s.fsf@nosuchdomain.example.com>
<uq98lm$40n1$6@dont-email.me> <87il2vbvza.fsf@nosuchdomain.example.com>
<uqau5o$11nm8$1@dont-email.me> <uqauo4$11vps$1@dont-email.me>
<uqg3dk$258lu$4@dont-email.me> <uqg4f3$25dn5$1@dont-email.me>
<uqgutd$2a91g$1@dont-email.me> <uqhule$2ilrc$2@dont-email.me>
<uqibhb$2kut0$1@dont-email.me> <uqiinc$2m4rb$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 15 Feb 2024 08:47:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="06d12749e5def29a78db342a8b927267";
logging-data="3385141"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18zZUUie+Qdb4DFxvS+Puoo"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:KHi/vpaczJMD7LoSPHDB9YZodqY=
 by: Lawrence D'Oliv - Thu, 15 Feb 2024 08:47 UTC

On Wed, 14 Feb 2024 15:29:00 +0100, David Brown wrote:

> In the DOS/Windows world, Pascal was a major language for a long time -
> starting with Turbo Pascal, then Borland Pascal for DOS then Windows,
> then Delphi. Delphi's descendants are still in heavy use for Windows
> development. (And dotnet came from Delphi and related projects.)

In the PC world generally, UCSD Pascal and its offshoots (of which Turbo
Pascal was one) were very popular.

The UCSD p-system pioneered the concept of “write once, run anywhere”, by
defining a standardized p-code interpreter that could be implemented
across a whole range of different processor architectures. Once you had
done that, plus some basic OS routines, the main part of the software,
written in Pascal, should port straight across.

Yes, there was a performance hit. But many people considered it worth
avoiding the pain of having to rewrite your code.

Re: How About Disallowing Assignments In Expressions?

<uqkj5c$379pl$7@dont-email.me>

  copy mid

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

  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: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Thu, 15 Feb 2024 08:48:44 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <uqkj5c$379pl$7@dont-email.me>
References: <uq3s76$28dsr$1@dont-email.me> <uq4nmb$2hive$6@dont-email.me>
<87r0hlef8q.fsf@nosuchdomain.example.com> <uq6nha$2spqe$3@dont-email.me>
<87sf20o4e2.fsf@bsb.me.uk> <uq86e9$37s7s$1@dont-email.me>
<uq93m2$3g3f$2@dont-email.me> <8734tzoli4.fsf@bsb.me.uk>
<uq979e$40n1$1@dont-email.me> <87v86vbx6s.fsf@nosuchdomain.example.com>
<uq98lm$40n1$6@dont-email.me> <87il2vbvza.fsf@nosuchdomain.example.com>
<uqau5o$11nm8$1@dont-email.me> <uqauo4$11vps$1@dont-email.me>
<uqg3dk$258lu$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 15 Feb 2024 08:48:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="06d12749e5def29a78db342a8b927267";
logging-data="3385141"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ZV+h8ElmFtUz8IFya3bWW"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:axQziM1bQfMDE/fW6dNNT0W1Buw=
 by: Lawrence D'Oliv - Thu, 15 Feb 2024 08:48 UTC

On Tue, 13 Feb 2024 16:55:32 +0100, Janis Papanagnou wrote:

> You are mistaken; C++ had no 'bool' type initially. It had been added
> later.

The first version of the C++ standard was C++98, and that had bool in it.

Re: How About Disallowing Assignments In Expressions?

<uqkja3$379pl$8@dont-email.me>

  copy mid

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

  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: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: How About Disallowing Assignments In Expressions?
Date: Thu, 15 Feb 2024 08:51:15 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <uqkja3$379pl$8@dont-email.me>
References: <uq3s76$28dsr$1@dont-email.me> <uq6nha$2spqe$3@dont-email.me>
<87sf20o4e2.fsf@bsb.me.uk> <uq86e9$37s7s$1@dont-email.me>
<uq93m2$3g3f$2@dont-email.me> <8734tzoli4.fsf@bsb.me.uk>
<uq979e$40n1$1@dont-email.me> <87v86vbx6s.fsf@nosuchdomain.example.com>
<uq98lm$40n1$6@dont-email.me> <87il2vbvza.fsf@nosuchdomain.example.com>
<uqau5o$11nm8$1@dont-email.me> <uqauo4$11vps$1@dont-email.me>
<uqb1vc$12k3v$1@dont-email.me> <uqd039$1fnp7$1@dont-email.me>
<uqduum$1mm6v$1@dont-email.me> <uqf801$20hb9$1@dont-email.me>
<uqfd4d$21bu6$1@dont-email.me> <uqfgnv$21tva$1@dont-email.me>
<uqfngh$235bb$1@dont-email.me> <uqft7s$2458n$1@dont-email.me>
<uqg1bv$24to4$1@dont-email.me> <877cj8axo6.fsf@nosuchdomain.example.com>
<uqgs2c$29nvr$1@dont-email.me> <uqhtvp$2ilrc$1@dont-email.me>
<uqi1f2$2j7mt$1@dont-email.me> <uqi3k1$2jhr8$1@dont-email.me>
<uqi5gs$2jtp3$1@dont-email.me> <uqibtl$2l0v9$1@dont-email.me>
<uqke4u$36p8j$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 15 Feb 2024 08:51:15 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="06d12749e5def29a78db342a8b927267";
logging-data="3385141"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/gsPdNhNikTrWH+tJ9eXG/"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:mHHubuFSIqxzwMLS6v1i1JMUR14=
 by: Lawrence D'Oliv - Thu, 15 Feb 2024 08:51 UTC

On Thu, 15 Feb 2024 08:23:09 +0100, Janis Papanagnou wrote:

> It's worth to add Awk to your list of script languages, since it's
> standard on Unix, and its syntax largely resembles the syntax of C.

Perl does everything Awk can do, and do it just as concisely, and it can
do more besides.

Re: Building Code Again

<uqkjjk$379pl$9@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!paganini.bofh.team!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Building Code Again
Date: Thu, 15 Feb 2024 08:56:20 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <uqkjjk$379pl$9@dont-email.me>
References: <uq3s76$28dsr$1@dont-email.me>
<877cj8axo6.fsf@nosuchdomain.example.com> <uqgs2c$29nvr$1@dont-email.me>
<uqhtvp$2ilrc$1@dont-email.me> <uqi1f2$2j7mt$1@dont-email.me>
<uqi3k1$2jhr8$1@dont-email.me> <uqi886$2kcqi$1@dont-email.me>
<20240214141410.00005ea0@yahoo.com> <uqii13$2m36v$1@dont-email.me>
<3v5zN.88071$GX69.76625@fx46.iad> <uqirrb$2o09g$1@dont-email.me>
<Sa7zN.358881$xHn7.264957@fx14.iad> <uqj4ml$2pnqa$1@dont-email.me>
<uqj6iv$2q00f$1@dont-email.me> <uqj9nj$2ql12$1@dont-email.me>
<3yazN.324761$Wp_8.75995@fx17.iad> <uqjo4k$2t0ca$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 15 Feb 2024 08:56:20 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="06d12749e5def29a78db342a8b927267";
logging-data="3385141"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19HdyDABNSCh2KK09IeL2Mo"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:gCE6Cfbok8AEqdSfkZHKs3lszUY=
 by: Lawrence D'Oliv - Thu, 15 Feb 2024 08:56 UTC

On Thu, 15 Feb 2024 01:07:33 +0000, bart wrote:

> Bollocks it is.

You keep insisting so. It would be simple enough to prove your point, by
stripping out this “needless” complexity and proving you can build the
code much more simply.

Otherwise, you just fall into the “methinks he doth protest too much”
school of Windows sufferers.


devel / comp.lang.c / Re: How About Disallowing Assignments In Expressions?

Pages:123456789101112131415161718192021
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor