Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Less is more or less more -- Y_Plentyn on #LinuxGER


devel / comp.lang.c / Re: iso646.h

SubjectAuthor
* iso646.hLawrence D'Oliveiro
+- Re: iso646.hLew Pitcher
+* Re: iso646.hJames Kuyper
|`- Re: iso646.hLawrence D'Oliveiro
`* Re: iso646.hDavid Brown
 +* Re: iso646.hScott Lurndal
 |`* Re: iso646.hLawrence D'Oliveiro
 | `* Re: iso646.hKeith Thompson
 |  `* Re: iso646.hLawrence D'Oliveiro
 |   `* Re: iso646.hKeith Thompson
 |    `* Re: iso646.hLawrence D'Oliveiro
 |     `- Re: iso646.hKaz Kylheku
 `* Re: iso646.hLawrence D'Oliveiro
  +- Re: iso646.hKaz Kylheku
  +* Re: iso646.hBlue-Maned_Hawk
  |`* Re: iso646.hLawrence D'Oliveiro
  | +- Re: iso646.hKaz Kylheku
  | `* Re: iso646.hJanis Papanagnou
  |  `* Re: iso646.hLawrence D'Oliveiro
  |   +- Re: iso646.hJanis Papanagnou
  |   `- Re: iso646.hKaz Kylheku
  +- Re: iso646.hTim Rentsch
  +* Re: iso646.hJanis Papanagnou
  |`* Re: iso646.hLawrence D'Oliveiro
  | `- Re: iso646.hJanis Papanagnou
  +* Re: iso646.hDavid Brown
  |`* Re: iso646.hKaz Kylheku
  | +- Re: iso646.hbart
  | +* Re: iso646.hJanis Papanagnou
  | |+* Re: iso646.hKeith Thompson
  | ||`* Re: iso646.hLawrence D'Oliveiro
  | || +* Re: iso646.hKeith Thompson
  | || |`* Re: iso646.hDavid Brown
  | || | `- Re: iso646.hJanis Papanagnou
  | || +* Re: iso646.hLew Pitcher
  | || |`* Re: iso646.hLawrence D'Oliveiro
  | || | +- Re: iso646.hLew Pitcher
  | || | +* Re: iso646.hKaz Kylheku
  | || | |`- Re: iso646.hChris M. Thomasson
  | || | `- Re: iso646.hScott Lurndal
  | || `- Re: iso646.hKaz Kylheku
  | |`* Re: iso646.hKaz Kylheku
  | | +- Re: iso646.hJanis Papanagnou
  | | `* Re: iso646.hJanis Papanagnou
  | |  `- Re: iso646.hKaz Kylheku
  | `- Re: iso646.hDavid Brown
  +- Re: iso646.hbart
  `* Re: iso646.hMalcolm McLean
   +* Re: iso646.hLew Pitcher
   |+- Re: iso646.hKaz Kylheku
   |+* Re: iso646.hLawrence D'Oliveiro
   ||+* Re: iso646.hKeith Thompson
   |||`* Re: iso646.hLawrence D'Oliveiro
   ||| +* Re: iso646.hKeith Thompson
   ||| |+- Re: iso646.hLawrence D'Oliveiro
   ||| |`- Re: iso646.hMalcolm McLean
   ||| `- Re: iso646.hJanis Papanagnou
   ||`- Re: iso646.hJanis Papanagnou
   |`* C/CPP macro conventions (was Re: iso646.h)Janis Papanagnou
   | `* Re: C/CPP macro conventions (was Re: iso646.h)Kaz Kylheku
   |  +- Re: C/CPP macro conventions (was Re: iso646.h)Janis Papanagnou
   |  +- Re: C/CPP macro conventions (was Re: iso646.h)David Brown
   |  `- Re: C/CPP macro conventions (was Re: iso646.h)Blue-Maned_Hawk
   +* Re: iso646.hbart
   |+* Re: iso646.hScott Lurndal
   ||`* Re: iso646.hJames Kuyper
   || +* Re: iso646.hKalevi Kolttonen
   || |+* Re: iso646.hLawrence D'Oliveiro
   || ||`* Re: iso646.hKaz Kylheku
   || || +* Re: iso646.hKalevi Kolttonen
   || || |`* Re: iso646.hJanis Papanagnou
   || || | `* Re: iso646.hJames Kuyper
   || || |  +* Re: iso646.hJanis Papanagnou
   || || |  |+- Re: iso646.hJanis Papanagnou
   || || |  |+* Re: iso646.hKalevi Kolttonen
   || || |  ||`* Re: iso646.hKalevi Kolttonen
   || || |  || `* Re: iso646.hLawrence D'Oliveiro
   || || |  ||  `- Re: iso646.hDavid Brown
   || || |  |`* Re: iso646.hKeith Thompson
   || || |  | `- Re: iso646.hKalevi Kolttonen
   || || |  +- Re: iso646.hLawrence D'Oliveiro
   || || |  `* Re: iso646.hKaz Kylheku
   || || |   `* Re: iso646.hJames Kuyper
   || || |    +* Re: iso646.hDavid Brown
   || || |    |+* Re: iso646.hJanis Papanagnou
   || || |    ||`* Re: iso646.hDavid Brown
   || || |    || `- Re: iso646.hJanis Papanagnou
   || || |    |`* Re: iso646.hbart
   || || |    | `- Re: iso646.hDavid Brown
   || || |    `- Re: iso646.hTim Rentsch
   || || `- Re: iso646.hJanis Papanagnou
   || |`- Unix shell conditionals (was Re: iso646.h)Janis Papanagnou
   || `* Re: iso646.hScott Lurndal
   ||  +* Re: iso646.hKaz Kylheku
   ||  |`* Re: iso646.hbart
   ||  | `- Re: iso646.hKaz Kylheku
   ||  +- Re: iso646.hKeith Thompson
   ||  `* Re: iso646.hJames Kuyper
   ||   `- Re: iso646.hJanis Papanagnou
   |+* Python (Re: iso646.h)Kalevi Kolttonen
   ||+* Re: Python (Re: iso646.h)bart
   ||+* Re: Python (Re: iso646.h)Keith Thompson
   ||+* Re: Python (Re: iso646.h)Lawrence D'Oliveiro
   ||`- Re: Python (Re: iso646.h)Dan Cross
   |+* Re: iso646.hKeith Thompson
   |`* Re: iso646.hMalcolm McLean
   `* Re: iso646.hLawrence D'Oliveiro

Pages:1234567891011121314151617181920212223242526
Re: iso646.h

<uoq59c$1m1bm$2@dont-email.me>

  copy mid

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

  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: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Tue, 23 Jan 2024 23:56:11 -0500
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <uoq59c$1m1bm$2@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uop0r1$1d4d4$1@dont-email.me> <87cytrajvc.fsf@nosuchdomain.example.com>
<uopcv5$1f17i$9@dont-email.me> <87zfwv8x3n.fsf@nosuchdomain.example.com>
<uopip7$1fs5l$6@dont-email.me> <87il3j8tjm.fsf@nosuchdomain.example.com>
<uopmm7$1ggo3$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 24 Jan 2024 04:56:12 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="9784eae7c916e6c05aac88b38cd3ce4e";
logging-data="1770870"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18OQWlX3v3ByYvgt/QzVqD3foC9lCtaGIc="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:vBsVc3fjZsPJv7VqMx773Aorr6w=
In-Reply-To: <uopmm7$1ggo3$3@dont-email.me>
Content-Language: en-US
 by: James Kuyper - Wed, 24 Jan 2024 04:56 UTC

On 1/23/24 19:47, Lawrence D'Oliveiro wrote:
> On Tue, 23 Jan 2024 16:27:25 -0800, Keith Thompson wrote:
>
>> I believe the only thing iso646.h demonstrates is the (largely former)
>> need to write C on systems that do not support full ASCII.
>
> It does seem a very late addition for a purpose which would have been a
> lot more relevant decades earlier. By that point, implementations that did
> not support full ASCII would have been museum pieces.

No, <iso646.h> was approved as part of AMD1, in 1995. For the countries
it was targeted at, full ASCII was not a tenable solution - it could not
be used to write their languages. The were still using encodings such as
shift-JIS and ISO/IEC 8859-10. Those did not become museum pieces until
after the widespread adoption of Unicode, which came out in 1996, and
did not become widely supported for many years after that.

>> If you want to use it in your own code, nobody will stop you.
>
> But will I continue to hear complaints from you about it?

If you've misunderstood the comments you've already received as
complaints, I think it's quite likely that you'll continue doing so.

Re: iso646.h

<uoq6um$1meme$3@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!weretis.net!feeder8.news.weretis.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: iso646.h
Date: Wed, 24 Jan 2024 05:24:39 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <uoq6um$1meme$3@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uop0r1$1d4d4$1@dont-email.me> <87cytrajvc.fsf@nosuchdomain.example.com>
<uopcv5$1f17i$9@dont-email.me> <87zfwv8x3n.fsf@nosuchdomain.example.com>
<uopip7$1fs5l$6@dont-email.me> <87il3j8tjm.fsf@nosuchdomain.example.com>
<uopmm7$1ggo3$3@dont-email.me> <uoq59c$1m1bm$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Jan 2024 05:24:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1447830fc94e947a2abc3c473a339dfd";
logging-data="1784526"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+NnWC8EbyiTQufeIcihSGG"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:VZvO8Y7uuUSoFWlcTGGEiQ4CKQs=
 by: Lawrence D'Oliv - Wed, 24 Jan 2024 05:24 UTC

On Tue, 23 Jan 2024 23:56:11 -0500, James Kuyper wrote:

> No, <iso646.h> was approved as part of AMD1, in 1995. For the countries
> it was targeted at, full ASCII was not a tenable solution - it could not
> be used to write their languages. The were still using encodings such as
> shift-JIS and ISO/IEC 8859-10.

But ASCII is a 7-bit code. The ISO 8859 codes are all ASCII supersets. And
also remember what the “shift” in “shift-JIS” stands for. Oh, and the name
of the corporation that created it in the first place is a bit of a
giveaway.

Re: iso646.h

<8734un8ewf.fsf@nosuchdomain.example.com>

  copy mid

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

  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: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Tue, 23 Jan 2024 21:43:44 -0800
Organization: None to speak of
Lines: 49
Message-ID: <8734un8ewf.fsf@nosuchdomain.example.com>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uop0r1$1d4d4$1@dont-email.me>
<87cytrajvc.fsf@nosuchdomain.example.com>
<uopcv5$1f17i$9@dont-email.me>
<87zfwv8x3n.fsf@nosuchdomain.example.com>
<uopip7$1fs5l$6@dont-email.me>
<87il3j8tjm.fsf@nosuchdomain.example.com>
<uopmm7$1ggo3$3@dont-email.me> <uoq59c$1m1bm$2@dont-email.me>
<uoq6um$1meme$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="1a14796772ccb3100f0d224a23edc517";
logging-data="1790377"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19f5RdlWX8uEfrvcn16fvvS"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:1UR3iPL/B7DUnrCZDuznEGCrfPw=
sha1:R04lIBQ9gL+xqsr0w+N5KGL8C6U=
 by: Keith Thompson - Wed, 24 Jan 2024 05:43 UTC

Lawrence D'Oliveiro <ldo@nz.invalid> writes:
> On Tue, 23 Jan 2024 23:56:11 -0500, James Kuyper wrote:
>> No, <iso646.h> was approved as part of AMD1, in 1995. For the countries
>> it was targeted at, full ASCII was not a tenable solution - it could not
>> be used to write their languages. The were still using encodings such as
>> shift-JIS and ISO/IEC 8859-10.
>
> But ASCII is a 7-bit code.

Yes, we know.

> The ISO 8859 codes are all ASCII supersets.

Right, so ISO 8859-10 might not have been a good example.

> And
> also remember what the “shift” in “shift-JIS” stands for.

Remember? I never knew. Feel free to enlighten us if it's relevant.

> Oh, and the name
> of the corporation that created it in the first place is a bit of a
> giveaway.

Since you don't seem inclined to share that information, it was
developed by a Japanese company called "ASCII Corporation". Perhaps you
could explain whether and how that's relevant.

In the Shift-JIS encoding, character 0x5C, which is the backslash in
ASCII and Unicode, is the Yen sign. That means that if a C source file
contains "Hello, world\n", viewing it as Shift-JIS makes it look like
"Hello, world¥n", but a C compiler that treats its input as ASCII would
see a backslash. C's use of almost all of the printable ASCII
characters caused problems on systems that used certain other character
sets. Trigraphs, digraphs, and <iso646.h> were all attempts to lessen
the impact of those problems. (Of these, only trigraphs are relevant
for the backslash character.)

EBCDIC systems were another problem area; for example at least some
variants of EBCDIC have no '[' and ']' characters.

Unicode and UTF-8 (or, if necessary, UTF-16) have largely reduced the
need for these solutions, but the problems were very real in 1995, and
may still be present in some niche environments today.

--
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: iso646.h

<uoq9ad$1mp2u$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.hispagatos.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: iso646.h
Date: Wed, 24 Jan 2024 06:05:01 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <uoq9ad$1mp2u$1@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me>
<pan$9db66$eb4f51b7$5c95cec0$b076ca4d@invalid.invalid>
<uomu7t$uj61$3@dont-email.me> <uonkbh$15dsi$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Jan 2024 06:05:01 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1447830fc94e947a2abc3c473a339dfd";
logging-data="1795166"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+13pXhy0OefxM2xnNnUgHS"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:TIflIOuToaXg0GP00sBJ82zj82M=
 by: Lawrence D'Oliv - Wed, 24 Jan 2024 06:05 UTC

On Tue, 23 Jan 2024 06:54:56 +0100, Janis Papanagnou wrote:

> ... in my professional contexts there where even [coding] standards
> defined that you had to follow.

What about the open-source code that your company takes without paying? Do
you demand that that code follow your rules as well? Do you send it back
to the developers to demand they rewrite it for you?

Re: iso646.h

<uoqb2o$1mu4a$4@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!feeder8.news.weretis.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: iso646.h
Date: Wed, 24 Jan 2024 06:35:05 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <uoqb2o$1mu4a$4@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uop0r1$1d4d4$1@dont-email.me> <87cytrajvc.fsf@nosuchdomain.example.com>
<uopcv5$1f17i$9@dont-email.me> <87zfwv8x3n.fsf@nosuchdomain.example.com>
<uopip7$1fs5l$6@dont-email.me> <87il3j8tjm.fsf@nosuchdomain.example.com>
<uopmm7$1ggo3$3@dont-email.me> <uoq59c$1m1bm$2@dont-email.me>
<uoq6um$1meme$3@dont-email.me> <8734un8ewf.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Jan 2024 06:35:05 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1447830fc94e947a2abc3c473a339dfd";
logging-data="1800330"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18TZxWMd2pIulupvigcfZkf"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:BDIJRrTwBUo9H920XtN+A+DENlc=
 by: Lawrence D'Oliv - Wed, 24 Jan 2024 06:35 UTC

On Tue, 23 Jan 2024 21:43:44 -0800, Keith Thompson wrote:

> In the Shift-JIS encoding, character 0x5C, which is the backslash in
> ASCII and Unicode, is the Yen sign. That means that if a C source file
> contains "Hello, world\n", viewing it as Shift-JIS makes it look like
> "Hello, world¥n", but a C compiler that treats its input as ASCII would
> see a backslash.

So what exactly does iso646.h offer to deal with this?

..

..

..

(crickets)

..

..

..

C/CPP macro conventions (was Re: iso646.h)

<uoqe1i$1nd2j$1@dont-email.me>

  copy mid

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

  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: janis_pa...@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.c
Subject: C/CPP macro conventions (was Re: iso646.h)
Date: Wed, 24 Jan 2024 08:25:37 +0100
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <uoqe1i$1nd2j$1@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uoosj4$1aidf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Jan 2024 07:25:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5cf70dd9151d44e9525f2aa8d96d1ce0";
logging-data="1815635"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/0myZ6fojoBysfXhsOcN1u"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:K5FCPlZyMYj201v7QoTa3o1cM+s=
In-Reply-To: <uoosj4$1aidf$1@dont-email.me>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Wed, 24 Jan 2024 07:25 UTC

On 23.01.2024 18:21, Lew Pitcher wrote:
> On Tue, 23 Jan 2024 16:32:09 +0000, Malcolm McLean wrote:
>> On 22/01/2024 20:34, Lawrence D'Oliveiro wrote:
>>> On Mon, 22 Jan 2024 09:30:21 +0100, David Brown wrote:
>>>
>>>> ... I don't use the matching names in C++ either ...
>>>
>>> I do, if/when I do use C++ and C. Don’t you think it improves readability:
>>>
>> It breaks the rule that, in C, variables and functions are alphnumeric,
>> whilst operators are symbols. sizeof is an exception, but a justified
>> one. However it's harder to justify a symbol for "plus" but a word for "or".
>
> Less importantly, it also violates the convention that C macros are named in
> upper case to distinguish them from keywords and "regular" identifiers.

Interestingly the convention had been (AFAICT) to uppercase *all* CPP
items, _mostly_. But in practice we've seen CPP function macros that
were lowercase even in system headers (ISTR some functions in stdio).
It certainly has advantages to uppercase macro functions to be sure
about possible side effects, like in FUNCT(a++). OTOH, for plain CPP
constants literals it's probably unnecessary to capitalize them.

> [...]

Janis

Unix shell conditionals (was Re: iso646.h)

<uoqeq0$1ngrn$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.niel.me!news.gegeweb.eu!gegeweb.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: Unix shell conditionals (was Re: iso646.h)
Date: Wed, 24 Jan 2024 08:38:39 +0100
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <uoqeq0$1ngrn$1@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uop0r1$1d4d4$1@dont-email.me> <GVTrN.46982$U1cc.26176@fx04.iad>
<uop3ml$1d8ao$2@dont-email.me> <uop7p7$1eahb$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 24 Jan 2024 07:38:40 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5cf70dd9151d44e9525f2aa8d96d1ce0";
logging-data="1819511"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18mDALZy0/YRUJo+WFH+5AZ"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:hf/xn+7R528U6y/j29uN4O8AlfU=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <uop7p7$1eahb$1@dont-email.me>
 by: Janis Papanagnou - Wed, 24 Jan 2024 07:38 UTC

On 23.01.2024 21:32, Kalevi Kolttonen wrote:
>
> The term "conditional and" is probably not so good, but the
> meaning of it here refers to the familiar short-circuiting
> behaviour of C's "&&". The same behaviour exists in, I
> think, all UNIX shells.
>
> If I write this in bash:
>
> rm foo.txt && rm bar.txt
>
> then if the first rm-command fails with a non-zero exit value,
> then the second rm-command is not executed at all.

I don't think shell's behavior is so intuitive (unless also
considering the evaluation semantics)

$ echo a || echo b && echo c
a c

Janis

Re: iso646.h

<uoqfl1$1nk81$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.chmurka.net!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: iso646.h
Date: Wed, 24 Jan 2024 08:53:05 +0100
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <uoqfl1$1nk81$1@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uont40$16rlc$1@dont-email.me>
<20240123131544.17@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Jan 2024 07:53:05 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5cf70dd9151d44e9525f2aa8d96d1ce0";
logging-data="1822977"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+bnBW1oC5efIZ7Bg579jOV"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:Q+mzkuHKZN+LGwjt83eIDPUTRmc=
In-Reply-To: <20240123131544.17@kylheku.com>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Wed, 24 Jan 2024 07:53 UTC

On 23.01.2024 22:30, Kaz Kylheku wrote:
> On 2024-01-23, David Brown <david.brown@hesbynett.no> wrote:
>> On 22/01/2024 21:34, Lawrence D'Oliveiro wrote:
>>> On Mon, 22 Jan 2024 09:30:21 +0100, David Brown wrote:
>>>
>>>> ... I don't use the matching names in C++ either ...
>>>
>>> I do, if/when I do use C++ and C. Don’t you think it improves readability:
>>
>> No. But I fully appreciate that this is personal preference and habit.
>
> I believe that some of the identifiers improves readability for people
> coming from a programming language which uses those English words for
> very similar operators rather than && and ||.

Well, I can only speaking for myself. But as someone originally coming
from such languages I have no problems with these operators. (== vs =
aggravated me more).

> [...]
>
> For that reason, these identifiers should not be used, except for
> machine-encoding of programs into a 6 bit character set.
>
> [...]
>
> Clearly, the purpose of this header is to allow C to be written with the
> ISO 646 character set. The choices of identifiers do not look like
> evidence of readability having been highly prioritized.

I don't quite understand your thought. The "6-bit characters" OSes
that I used had no lowercase letters, as opposed to IA5/ASCII/ISO646.

To be sure I had also re-inspected the ASCII character set and it
seems that all C characters (including these operators) are anyway
in the ASCII domain. It's beyond me why they've used the name
"iso646.h".

Janis

Re: iso646.h

<uoqg20$1nlm5$1@dont-email.me>

  copy mid

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

  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: iso646.h
Date: Wed, 24 Jan 2024 08:59:59 +0100
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <uoqg20$1nlm5$1@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uonjsu$15b7p$1@dont-email.me>
<uopca9$1f17i$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 24 Jan 2024 08:00:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5cf70dd9151d44e9525f2aa8d96d1ce0";
logging-data="1824453"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Y2xaL3buprYp5yNoHd4rL"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:nJCvWml/eDw649aUGAeMBo+jgQQ=
In-Reply-To: <uopca9$1f17i$3@dont-email.me>
 by: Janis Papanagnou - Wed, 24 Jan 2024 07:59 UTC

On 23.01.2024 22:50, Lawrence D'Oliveiro wrote:
> On Tue, 23 Jan 2024 06:47:10 +0100, Janis Papanagnou wrote:
>
>> There's also problems with these names. For example '&&' has not the
>> semantics of 'and' but of 'and_then', 'or' is actually 'or_else'.
>
> Funnily enough, that is how the languages that offer those words interpret
> them. Not just C and C++.

From the languages I know of that support them (Ada and Eiffel) these
languages support both forms.

Janis

Re: iso646.h

<uoqg5q$1nlm5$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.nntp4.net!news.hispagatos.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: iso646.h
Date: Wed, 24 Jan 2024 09:02:02 +0100
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <uoqg5q$1nlm5$2@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uoosj4$1aidf$1@dont-email.me> <uopcdv$1f17i$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 24 Jan 2024 08:02:02 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5cf70dd9151d44e9525f2aa8d96d1ce0";
logging-data="1824453"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18numP5RTj62rwj3LUTwZMc"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:M8vc5LANEboE4qOwA9Ct+lVytbE=
In-Reply-To: <uopcdv$1f17i$5@dont-email.me>
 by: Janis Papanagnou - Wed, 24 Jan 2024 08:02 UTC

On 23.01.2024 22:52, Lawrence D'Oliveiro wrote:
> On Tue, 23 Jan 2024 17:21:40 -0000 (UTC), Lew Pitcher wrote:
>
>> Less importantly, it also violates the convention that C macros are
>> named in upper case to distinguish them from keywords and "regular"
>> identifiers.
>
> Why does C allow lowercase in macro names, then?

It's the nature of "conventions" to take the place where there's no
rule.

Janis

Re: iso646.h

<uoqgdv$1nog8$1@dont-email.me>

  copy mid

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

  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: iso646.h
Date: Wed, 24 Jan 2024 09:06:22 +0100
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <uoqgdv$1nog8$1@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uop0r1$1d4d4$1@dont-email.me> <87cytrajvc.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 24 Jan 2024 08:06:23 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5cf70dd9151d44e9525f2aa8d96d1ce0";
logging-data="1827336"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19D8NHq7qNqKCkmbz9C0Fuk"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:H5T3RV7gKPhClfmks97cR+3pyWY=
In-Reply-To: <87cytrajvc.fsf@nosuchdomain.example.com>
 by: Janis Papanagnou - Wed, 24 Jan 2024 08:06 UTC

On 23.01.2024 21:13, Keith Thompson wrote:
> [...] There's no hard rule that operators must be
> punctuation, just a general trend.)

Anyone still writing "MULTIPLY a BY b GIVEN c" ? :-)

(Luckily I've never programmed in COBOL, even after
it allowed "COMPUTE c = a * b" (or some such).)

Janis

Re: iso646.h

<uoqgj1$1nog8$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!feeder8.news.weretis.net!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: iso646.h
Date: Wed, 24 Jan 2024 09:09:05 +0100
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <uoqgj1$1nog8$2@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uop0r1$1d4d4$1@dont-email.me> <GVTrN.46982$U1cc.26176@fx04.iad>
<uop3ml$1d8ao$2@dont-email.me> <uop7p7$1eahb$1@dont-email.me>
<uopcfr$1f17i$6@dont-email.me> <20240123140604.828@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 24 Jan 2024 08:09:05 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5cf70dd9151d44e9525f2aa8d96d1ce0";
logging-data="1827336"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+MP0pi9LO4dhaSv/HVfEAQ"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:X6Vk29Drfjtk3CIpJHB/9s+H7eE=
In-Reply-To: <20240123140604.828@kylheku.com>
 by: Janis Papanagnou - Wed, 24 Jan 2024 08:09 UTC

On 23.01.2024 23:09, Kaz Kylheku wrote:
> [...]
> whereas in the shell:
>
> (((a && b) || c) && d)
>
> where I'm using "virtual parentheses". If you actually stick in real
> ones, they denote subshell execution in a separate process. (Bash
> allows curly braces for command grouping that doesn't create
> processes.)

Make that "POSIX allows..." (it's standard behavior for POSIX shells).

Janis

Re: iso646.h

<uoqgmf$1nog8$3@dont-email.me>

  copy mid

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

  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: iso646.h
Date: Wed, 24 Jan 2024 09:10:55 +0100
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <uoqgmf$1nog8$3@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uop0r1$1d4d4$1@dont-email.me> <GVTrN.46982$U1cc.26176@fx04.iad>
<uop3ml$1d8ao$2@dont-email.me> <uop7p7$1eahb$1@dont-email.me>
<uopcfr$1f17i$6@dont-email.me> <20240123140604.828@kylheku.com>
<uopf3q$1fgi6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 24 Jan 2024 08:10:55 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5cf70dd9151d44e9525f2aa8d96d1ce0";
logging-data="1827336"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Gf/DqYQLvLFYckAUD6qvl"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:2KYa3/zYFpiUS3h5wPdAjg4Axps=
In-Reply-To: <uopf3q$1fgi6$1@dont-email.me>
 by: Janis Papanagnou - Wed, 24 Jan 2024 08:10 UTC

On 23.01.2024 23:37, Kalevi Kolttonen wrote:
>
> [...] I am
> pretty sure that not all computer languages
> provide guarantees about the order of evaluation.

What?!

Janis

Re: iso646.h

<uoqgvf$1nog8$4@dont-email.me>

  copy mid

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

  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: iso646.h
Date: Wed, 24 Jan 2024 09:15:43 +0100
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <uoqgvf$1nog8$4@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uoosj4$1aidf$1@dont-email.me> <uopcdv$1f17i$5@dont-email.me>
<874jf3acjb.fsf@nosuchdomain.example.com> <uopics$1fs5l$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Jan 2024 08:15:43 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5cf70dd9151d44e9525f2aa8d96d1ce0";
logging-data="1827336"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/u9OYZPVwG+COQ4u0qATy6"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:M+xR7EE1MwpajZVouowRQLTVOB8=
In-Reply-To: <uopics$1fs5l$3@dont-email.me>
 by: Janis Papanagnou - Wed, 24 Jan 2024 08:15 UTC

On 24.01.2024 00:33, Lawrence D'Oliveiro wrote:
> On Tue, 23 Jan 2024 14:51:52 -0800, Keith Thompson wrote:
>
>> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>>
>>> On Tue, 23 Jan 2024 17:21:40 -0000 (UTC), Lew Pitcher wrote:
>>>
>>>> Less importantly, it also violates the convention that C macros are
>>>> named in upper case to distinguish them from keywords and "regular"
>>>> identifiers.
>>>
>>> Why does C allow lowercase in macro names, then?
>>
>> Because it's a convention, not a language rule.
>
> So what would one mean by “violate”, other than “I personally don’t like
> it”?

I would interpret it in [professional] project contexts where more
than one person is programming on the same project.

Janis

Re: C/CPP macro conventions (was Re: iso646.h)

<20240124001809.179@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!feeder8.news.weretis.net!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: C/CPP macro conventions (was Re: iso646.h)
Date: Wed, 24 Jan 2024 08:25:49 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <20240124001809.179@kylheku.com>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uoosj4$1aidf$1@dont-email.me> <uoqe1i$1nd2j$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Jan 2024 08:25:49 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b53ada80e44a49509d1cc2e54e523b05";
logging-data="1830246"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/V+bbx8a+uGHmiHchKNlwUa5UMAjg8Fg="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:1SEHVAliktRw6tirprnMRFNbCqk=
 by: Kaz Kylheku - Wed, 24 Jan 2024 08:25 UTC

On 2024-01-24, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
> On 23.01.2024 18:21, Lew Pitcher wrote:
>> On Tue, 23 Jan 2024 16:32:09 +0000, Malcolm McLean wrote:
>>> On 22/01/2024 20:34, Lawrence D'Oliveiro wrote:
>>>> On Mon, 22 Jan 2024 09:30:21 +0100, David Brown wrote:
>>>>
>>>>> ... I don't use the matching names in C++ either ...
>>>>
>>>> I do, if/when I do use C++ and C. Don’t you think it improves readability:
>>>>
>>> It breaks the rule that, in C, variables and functions are alphnumeric,
>>> whilst operators are symbols. sizeof is an exception, but a justified
>>> one. However it's harder to justify a symbol for "plus" but a word for "or".
>>
>> Less importantly, it also violates the convention that C macros are named in
>> upper case to distinguish them from keywords and "regular" identifiers.
>
> Interestingly the convention had been (AFAICT) to uppercase *all* CPP
> items, _mostly_. But in practice we've seen CPP function macros that
> were lowercase even in system headers (ISTR some functions in stdio).
> It certainly has advantages to uppercase macro functions to be sure
> about possible side effects, like in FUNCT(a++). OTOH, for plain CPP
> constants literals it's probably unnecessary to capitalize them.

You might think, but due to scoping, they can cause problems, unless
they are namespaced. If you define macro like

#define speed 42.0

anything which includes this cannot use the speed identifier
for any purpose. Not as a structure member name, enumerator, parameter
name, function name, typedef, goto label, nothing.

If we use SPEED instead, and never use such an identifier as a function,
parameter, or any of those roles I mentioned, then we have a kind of
namespace separation.

This is why simple constants are capitalized.

What we don't want to capitalize are function-like macros (those
that take parameters) which are well-behaved and blend nicely into the
language. Making them SHOUT just reduces the nice blending.

A function-like macro is not invoked if it is not followed by an open
parenthesis, which reduces the possibility of a clash.

Macros that do weird things, and/or have severe or bizarre contextual
restrictions on their use probably ought to SHOUT.

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

Re: iso646.h

<uoqhms$1nu0i$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.swapon.de!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: iso646.h
Date: Wed, 24 Jan 2024 09:28:11 +0100
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <uoqhms$1nu0i$1@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uop0r1$1d4d4$1@dont-email.me> <GVTrN.46982$U1cc.26176@fx04.iad>
<uop3ml$1d8ao$2@dont-email.me> <XbWrN.302617$xHn7.29225@fx14.iad>
<uopmk3$1gha5$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 24 Jan 2024 08:28:12 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5cf70dd9151d44e9525f2aa8d96d1ce0";
logging-data="1832978"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19DLQ6NissgCwH2yI5wF1Iq"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:Ie1a0u4KZ2NbTivd2o8X3NP2d70=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <uopmk3$1gha5$1@dont-email.me>
 by: Janis Papanagnou - Wed, 24 Jan 2024 08:28 UTC

On 24.01.2024 01:45, James Kuyper wrote:
> On 1/23/24 16:28, Scott Lurndal wrote:
>>
>> The term 'conditional and' has been in common use for decades.
>
> I've never heard of it. When searching Wikipedia, [...]

In the context of Ada I read about "boolean operator" ('and')
and "boolean shortcut operator" ('and then').

In an Eiffel book (which oriented its this operator choice on Ada)
they speak about "non-commutative" operators when the mean the e.g.
'and then' sorts of operators.

In my book the other formulation(s) mentioned in the threads are
clear enough to understand them (I did, at least) and unless one
is on the argument trip we should stop that fruitless discussion.

Janis

Re: iso646.h

<uoqi2g$1nu0i$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.furie.org.uk!nntp.terraraq.uk!news.gegeweb.eu!gegeweb.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: iso646.h
Date: Wed, 24 Jan 2024 09:34:24 +0100
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <uoqi2g$1nu0i$2@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me>
<pan$9db66$eb4f51b7$5c95cec0$b076ca4d@invalid.invalid>
<uomu7t$uj61$3@dont-email.me> <uonkbh$15dsi$1@dont-email.me>
<uoq9ad$1mp2u$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 24 Jan 2024 08:34:24 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5cf70dd9151d44e9525f2aa8d96d1ce0";
logging-data="1832978"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19oLnOiVyl5gBjPIZ73t/KS"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:vImjAwFVHUlbtf1nfv3iRduVH2Q=
In-Reply-To: <uoq9ad$1mp2u$1@dont-email.me>
 by: Janis Papanagnou - Wed, 24 Jan 2024 08:34 UTC

On 24.01.2024 07:05, Lawrence D'Oliveiro wrote:
> On Tue, 23 Jan 2024 06:54:56 +0100, Janis Papanagnou wrote:
>
>> ... in my professional contexts there where even [coding] standards
>> defined that you had to follow.
>
> What about the open-source code that your company takes without paying? Do
> you demand that that code follow your rules as well? Do you send it back
> to the developers to demand they rewrite it for you?

Since you're making up your comfort situations feel free to answer them
yourself.

Re: iso646.h

<uoqifs$1o2c1$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!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: iso646.h
Date: Wed, 24 Jan 2024 09:41:31 +0100
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <uoqifs$1o2c1$1@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uop0r1$1d4d4$1@dont-email.me> <87cytrajvc.fsf@nosuchdomain.example.com>
<uopcv5$1f17i$9@dont-email.me> <87zfwv8x3n.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 24 Jan 2024 08:41:32 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5cf70dd9151d44e9525f2aa8d96d1ce0";
logging-data="1837441"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7fgn28LDLQlQ6eFG7VEih"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:+dxWe6bsw+8Dw3dmC3cKpnd2B6o=
In-Reply-To: <87zfwv8x3n.fsf@nosuchdomain.example.com>
 by: Janis Papanagnou - Wed, 24 Jan 2024 08:41 UTC

On 24.01.2024 00:10, Keith Thompson wrote:
>
> The header was introduced to make it easier (or possible) to write C
> code on systems/keyboards that don't support certain characters like '&'
> and '|' -- similar to digraphs and trigraphs.

I think this is the most likely explanation; the restricted _keyboards_
(and not the restricted [ASCII] character set). Matches my experiences
with old keyboards I used decades ago.

Janis

Re: iso646.h

<uoqjo7$1o34g$2@dont-email.me>

  copy mid

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

  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: iso646.h
Date: Wed, 24 Jan 2024 10:03:03 +0100
Organization: A noiseless patient Spider
Lines: 80
Message-ID: <uoqjo7$1o34g$2@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uont40$16rlc$1@dont-email.me>
<20240123131544.17@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Jan 2024 09:03:03 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="65507ed2e59e1ed5857440a8f8a39c64";
logging-data="1838224"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19FURYkLuyqcs4JgmARRgHXAG4+VwLg2EI="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:lbt4PoiWWr7F3uxSd/NH5h6wx+0=
In-Reply-To: <20240123131544.17@kylheku.com>
Content-Language: en-GB
 by: David Brown - Wed, 24 Jan 2024 09:03 UTC

On 23/01/2024 22:30, Kaz Kylheku wrote:
> On 2024-01-23, David Brown <david.brown@hesbynett.no> wrote:
>> On 22/01/2024 21:34, Lawrence D'Oliveiro wrote:
>>> On Mon, 22 Jan 2024 09:30:21 +0100, David Brown wrote:
>>>
>>>> ... I don't use the matching names in C++ either ...
>>>
>>> I do, if/when I do use C++ and C. Don’t you think it improves readability:
>>
>> No. But I fully appreciate that this is personal preference and habit.
>
> I believe that some of the identifiers improves readability for people
> coming from a programming language which uses those English words for
> very similar operators rather than && and ||.
>
> In a green field programming language design, it's probably better
> to design that way from the start. It's a nice bonus if a language
> looks readable to newcomers.
>

Agreed.

> Generations of C coders are used to && and || though; that's the normal
> way to write C. Using these aliases is a vanishingly rare practice. An
> important aspect of readability is writing code like everyone else. When
> a language is newly designed so that there isn't anyone else, that
> doesn't have to be considered.
>

Agreed. (Although people coming to your new language probably have
experience with some other languages, and you'll want to avoid being
confusingly different from common existing languages. Choosing "&&" and
"&" for "bitwise and" and "logical and" would be a bad idea for a new
language, even if it arguably makes more sense based on the prevalence
of these operator usages.)

> For that reason, these identifiers should not be used, except for
> machine-encoding of programs into a 6 bit character set.
>
> Additionally certain names in the iso646.h header are poorly considered,
> and obstruct readability. They use the _eq suffix for an operation that
> is assignment.
>
> #define and_eq &=
>
> If the purpose of this header were to optimize readability for those
> unfamiliar with C, this should be called
>
> #define and_set &=
>
> or similar.

Or "bitmask" ?

>
> The assignment operator = should not be read "equals", but "becomes" or
> "takes the value" or "is assigned" or "is set to". This should be taken
> into consideration when coming up with word-like token or token fragment
> to represent it.

Yes.

>
> Also note the following inconsistency:
>
> #define and &&
> #define bitand &
> #define and_eq &= // what happened to "bit"?
>
> This looks like and_eq should correspond to &&=, since and is &&,
> and bitand is &. &= wants to be bitand_eq.
>
> Clearly, the purpose of this header is to allow C to be written with the
> ISO 646 character set. The choices of identifiers do not look like
> evidence of readability having been highly prioritized.
>

They are still better than trigraphs :-)

Re: C/CPP macro conventions (was Re: iso646.h)

<uoqk3o$1oali$1@dont-email.me>

  copy mid

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

  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: C/CPP macro conventions (was Re: iso646.h)
Date: Wed, 24 Jan 2024 10:09:11 +0100
Organization: A noiseless patient Spider
Lines: 73
Message-ID: <uoqk3o$1oali$1@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uoosj4$1aidf$1@dont-email.me> <uoqe1i$1nd2j$1@dont-email.me>
<20240124001809.179@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Jan 2024 09:09:12 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5cf70dd9151d44e9525f2aa8d96d1ce0";
logging-data="1845938"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+0yrvXNrC/iUWyA/O/9C5E"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:z8hjeBdpcII57ur+ZFFrfJF73Tk=
In-Reply-To: <20240124001809.179@kylheku.com>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Wed, 24 Jan 2024 09:09 UTC

On 24.01.2024 09:25, Kaz Kylheku wrote:
> On 2024-01-24, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>> On 23.01.2024 18:21, Lew Pitcher wrote:
>>> On Tue, 23 Jan 2024 16:32:09 +0000, Malcolm McLean wrote:
>>>> On 22/01/2024 20:34, Lawrence D'Oliveiro wrote:
>>>>> On Mon, 22 Jan 2024 09:30:21 +0100, David Brown wrote:
>>>>>
>>>>>> ... I don't use the matching names in C++ either ...
>>>>>
>>>>> I do, if/when I do use C++ and C. Don’t you think it improves readability:
>>>>>
>>>> It breaks the rule that, in C, variables and functions are alphnumeric,
>>>> whilst operators are symbols. sizeof is an exception, but a justified
>>>> one. However it's harder to justify a symbol for "plus" but a word for "or".
>>>
>>> Less importantly, it also violates the convention that C macros are named in
>>> upper case to distinguish them from keywords and "regular" identifiers.
>>
>> Interestingly the convention had been (AFAICT) to uppercase *all* CPP
>> items, _mostly_. But in practice we've seen CPP function macros that
>> were lowercase even in system headers (ISTR some functions in stdio).
>> It certainly has advantages to uppercase macro functions to be sure
>> about possible side effects, like in FUNCT(a++). OTOH, for plain CPP
>> constants literals it's probably unnecessary to capitalize them.
>
> You might think, but due to scoping, they can cause problems, unless
> they are namespaced. If you define macro like
>
> #define speed 42.0
>
> anything which includes this cannot use the speed identifier
> for any purpose. Not as a structure member name, enumerator, parameter
> name, function name, typedef, goto label, nothing.

Umm.., but that is just a normal name clash situation.

I mean I see where you're coming from but that doesn't seem convincing.
The convention then "disallows" (sort of) use of
char* TLA = "three letter acronym";
because its lexical form is "reserved" (in an artificial name-space)
for CPP entities?

I suppose we just disagree on that point (or have other preferences).

>
> If we use SPEED instead, and never use such an identifier as a function,
> parameter, or any of those roles I mentioned, then we have a kind of
> namespace separation.
>
> This is why simple constants are capitalized.
>
> What we don't want to capitalize are function-like macros (those
> that take parameters) which are well-behaved and blend nicely into the
> language. Making them SHOUT just reduces the nice blending.
>
> A function-like macro is not invoked if it is not followed by an open
> parenthesis, which reduces the possibility of a clash.
>
> Macros that do weird things, and/or have severe or bizarre contextual
> restrictions on their use probably ought to SHOUT.

I'm familiar a design philosophy where it's even unnecessary to write
parenthesis in function calls in case there's no arguments, so I know
what you're aiming at. Only the fact that the CPP is just a poor tool
that does simple replacements may lead to issues, say, FUN(a) a+a
and a call with FUN(b++) . Notwithstanding that we could discuss the
responsibility of the macro designer, such behavior at least may be a
reason to clearly indicate that caution is necessary here.

I think we agree here.

Janis

Re: C/CPP macro conventions (was Re: iso646.h)

<uoqkau$1o34g$3@dont-email.me>

  copy mid

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

  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: C/CPP macro conventions (was Re: iso646.h)
Date: Wed, 24 Jan 2024 10:13:02 +0100
Organization: A noiseless patient Spider
Lines: 73
Message-ID: <uoqkau$1o34g$3@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uoosj4$1aidf$1@dont-email.me> <uoqe1i$1nd2j$1@dont-email.me>
<20240124001809.179@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Jan 2024 09:13:02 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="65507ed2e59e1ed5857440a8f8a39c64";
logging-data="1838224"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/yRoL1ce9OkGRq06rHxComCPSDSbApE58="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:IBBEJMyCltdYq9aVkEbmCXY84/I=
Content-Language: en-GB
In-Reply-To: <20240124001809.179@kylheku.com>
 by: David Brown - Wed, 24 Jan 2024 09:13 UTC

On 24/01/2024 09:25, Kaz Kylheku wrote:
> On 2024-01-24, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>> On 23.01.2024 18:21, Lew Pitcher wrote:
>>> On Tue, 23 Jan 2024 16:32:09 +0000, Malcolm McLean wrote:
>>>> On 22/01/2024 20:34, Lawrence D'Oliveiro wrote:
>>>>> On Mon, 22 Jan 2024 09:30:21 +0100, David Brown wrote:
>>>>>
>>>>>> ... I don't use the matching names in C++ either ...
>>>>>
>>>>> I do, if/when I do use C++ and C. Don’t you think it improves readability:
>>>>>
>>>> It breaks the rule that, in C, variables and functions are alphnumeric,
>>>> whilst operators are symbols. sizeof is an exception, but a justified
>>>> one. However it's harder to justify a symbol for "plus" but a word for "or".
>>>
>>> Less importantly, it also violates the convention that C macros are named in
>>> upper case to distinguish them from keywords and "regular" identifiers.
>>
>> Interestingly the convention had been (AFAICT) to uppercase *all* CPP
>> items, _mostly_. But in practice we've seen CPP function macros that
>> were lowercase even in system headers (ISTR some functions in stdio).
>> It certainly has advantages to uppercase macro functions to be sure
>> about possible side effects, like in FUNCT(a++). OTOH, for plain CPP
>> constants literals it's probably unnecessary to capitalize them.
>
> You might think, but due to scoping, they can cause problems, unless
> they are namespaced. If you define macro like
>
> #define speed 42.0
>
> anything which includes this cannot use the speed identifier
> for any purpose. Not as a structure member name, enumerator, parameter
> name, function name, typedef, goto label, nothing.
>
> If we use SPEED instead, and never use such an identifier as a function,
> parameter, or any of those roles I mentioned, then we have a kind of
> namespace separation.
>
> This is why simple constants are capitalized.

A better choice would be:

static const double speed = 42.0;

That has none of the scoping or identifier issues that you mention.

Alternatively, if I had to use #define for some reason, I'd prefer:

#define maximum_speed 42.0

or some other appropriate name that would not clash with other
identifiers (in that translation unit) because it has a unique name that
will not be re-used. I find that far neater than using all-caps to make
an alternative namespace.

>
> What we don't want to capitalize are function-like macros (those
> that take parameters) which are well-behaved and blend nicely into the
> language. Making them SHOUT just reduces the nice blending.
>
> A function-like macro is not invoked if it is not followed by an open
> parenthesis, which reduces the possibility of a clash.
>
> Macros that do weird things, and/or have severe or bizarre contextual
> restrictions on their use probably ought to SHOUT.
>

Agreed.

I need good reasons to SHOUT an identifier - it needs to be something
that can easily have unexpected effects.

Re: Python (Re: iso646.h)

<uoqsqc$1pj0b$1@dont-email.me>

  copy mid

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

  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: Python (Re: iso646.h)
Date: Wed, 24 Jan 2024 12:37:48 +0100
Organization: A noiseless patient Spider
Lines: 80
Message-ID: <uoqsqc$1pj0b$1@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uop0r1$1d4d4$1@dont-email.me> <uop48a$1dmoe$1@dont-email.me>
<uopclb$1f17i$7@dont-email.me> <uopfm2$1fj5r$1@dont-email.me>
<uopk9l$1g631$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Jan 2024 11:37:48 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="65507ed2e59e1ed5857440a8f8a39c64";
logging-data="1887243"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18fg1UVP79fmF2/YDCRz+cpWn6yB5sIblg="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:xRNwah54YqHqBqsuHqFK7y1PhQI=
In-Reply-To: <uopk9l$1g631$1@dont-email.me>
Content-Language: en-GB
 by: David Brown - Wed, 24 Jan 2024 11:37 UTC

On 24/01/2024 01:06, bart wrote:
> On 23/01/2024 22:47, Kalevi Kolttonen wrote:
>> Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
>>> On Tue, 23 Jan 2024 19:32:26 -0000 (UTC), Kalevi Kolttonen wrote:
>>>
>>>> Dennis Ritchie has said that he regretted the spelling of creat(2)
>>>> function. Presumably the abbreviation was supposed to save one byte of
>>>> storage.
>>>
>>> Given that, in POSIX, all the functions of creat(2) have been subsumed
>>> under open(2) anyway, we can largely ignore that.
>>
>> I know. creat() is now completely redundant because
>> open() suffices. The reason I brought it up was just
>> so that people would realize that at least sometimes
>> it was a matter of saving storage space - even one
>> byte.
>>
>>> There are other worse problems with C. Like its use of “=” (the
>>> mathematical equality operator) for assignment, instead of using the
>>> “:=”
>>> symbol that the Algols had adopted.
>>
>> Well I started with Microsoft BASIC on Commodore 64 39 years ago.
>> So I am well used to "=" and do not consider it a problem.
>
> I've used ":=" with Algol and "=" with Fortran (a bit longer ago).
>
> That is not itself the problem.
>
> The problem is allowing both assignment and equality within the same
> expression, which is what C does. Algol, Fortran and BASIC didn't do that.
>
> If that wasn't the case, then you could use "=" for both assignment, and
> equality, without ambiguity.
>
> Languages that use ":=" and "=" for those operations, fare better than C
> that uses "=" and "==".
>
>>>> But the Python designers botched at least one thing concerning that
>>>> philosophy: private functions are not defined by "private" keyword like
>>>> in Java but instead the designers violated their own basic principle of
>>>> easy readability: the "privateness" is defined by by prefixing the
>>>> function names with an underscore ("_").
>>>
>>> That is merely a convention, a hint that the user might want to stay
>>> away
>>> from such a symbol, not a hard requirement, which is why it was designed
>>> that way. As Guido van Rossum has said: “We are all consenting adults
>>> here”.
>>
>> What?! Are you saying that there is no way to label functions as private
>> in Python? That sounds absolutely horrible. Why would anyone design a
>> language with object-oriented features without support for encapsulation?
>
> Python is 'ultra-dynamic'. That's why it's so hard to make it
> performant. So you can do this:
>
>     import math
>
>     math.pi = "pie"
>     math.sqrt = lambda x:x*x
>
>     print(math.pi*2)
>     print(math.sqrt(10))
>
> Output is:
>
>     piepie
>     100
>

Nothing beats Forth:

: 1 2 ; ok
1 1 + . 4 ok

Redefining "1" to mean "2" is a great way to obfuscate your code :-)

Re: iso646.h

<uoqtnp$1ppa5$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: malcolm....@gmail.com (Malcolm McLean)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Wed, 24 Jan 2024 11:53:28 +0000
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <uoqtnp$1ppa5$1@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uoosj4$1aidf$1@dont-email.me> <uopcdv$1f17i$5@dont-email.me>
<874jf3acjb.fsf@nosuchdomain.example.com> <uopics$1fs5l$3@dont-email.me>
<87mssv8u1s.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Jan 2024 11:53:29 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="30a3621b52039f4ba28278bd7966fb2b";
logging-data="1893701"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18aUGZQLXXfoHJlL/HjgoSf06GT4Lk56U4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:X0g1VcckH96oCGLPBm7U8nF8P4I=
In-Reply-To: <87mssv8u1s.fsf@nosuchdomain.example.com>
Content-Language: en-GB
 by: Malcolm McLean - Wed, 24 Jan 2024 11:53 UTC

On 24/01/2024 00:16, Keith Thompson wrote:
> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>> On Tue, 23 Jan 2024 14:51:52 -0800, Keith Thompson wrote:
>>> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>>>> On Tue, 23 Jan 2024 17:21:40 -0000 (UTC), Lew Pitcher wrote:
>>>>> Less importantly, it also violates the convention that C macros are
>>>>> named in upper case to distinguish them from keywords and "regular"
>>>>> identifiers.
>>>>
>>>> Why does C allow lowercase in macro names, then?
>>>
>>> Because it's a convention, not a language rule.
>>
>> So what would one mean by “violate”, other than “I personally don’t like
>> it”?
>
> Obviously, it would mean not following the convention.
>
> There clearly is a convention that most macro names should be defined in
> all caps. Equally clearly, the standard library does not uniformly
> follow that convention. I have no problem with that.
>
> I might have some more thoughts on the matter, but I'm not sure where
> you're going with this.
>
I always write clamp() and lerp() in any numerical C code that goes
beyond a certain complexity. They are function-like macros, and should
look like functions. Of course you can pass parameters with side
effects, but unlikely in practice.
--
Check out Basic Algorithms and my other books:
https://www.lulu.com/spotlight/bgy1mm

Re: iso646.h

<uoqvas$1q40p$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.hispagatos.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: malcolm....@gmail.com (Malcolm McLean)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Wed, 24 Jan 2024 12:20:43 +0000
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <uoqvas$1q40p$1@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uop0r1$1d4d4$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Jan 2024 12:20:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="30a3621b52039f4ba28278bd7966fb2b";
logging-data="1904665"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19EU31W1ru+5E98S68W2ZFAybhWbp4G2X8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:C1dtNytrQ9ETofupzekUu/hN6Mc=
In-Reply-To: <uop0r1$1d4d4$1@dont-email.me>
Content-Language: en-GB
 by: Malcolm McLean - Wed, 24 Jan 2024 12:20 UTC

On 23/01/2024 18:34, bart wrote:
> On 23/01/2024 16:32, Malcolm McLean wrote:
>> On 22/01/2024 20:34, Lawrence D'Oliveiro wrote:
>>> On Mon, 22 Jan 2024 09:30:21 +0100, David Brown wrote:
>>>
>>>> ... I don't use the matching names in C++ either ...
>>>
>>> I do, if/when I do use C++ and C. Don’t you think it improves
>>> readability:
>>>
>> It breaks the rule that, in C, variables and functions are
>> alphnumeric, whilst operators are symbols. sizeof is an exception, but
>> a justified one. However it's harder to justify a symbol for "plus"
>> but a word for "or".
>
> But it's OK to justify 'pow' for exponentiation?
>
Mathematically operators are functions, so a mathematican would say that
"add" is just as much of a function as "gamma". But to a computer
programmer an operator compiles to a trivial number of machine code
instructions, whilst a function is a subroutine call. Pow is not usually
supported in hardware. However it's such a basic mathematical function
that it has special notation. So some languages say it should be an
operator. However ASCII won't represent the standard notation. SO there
are good arguments for and against pow as an operators, and different
language take differnet views. But I think the C decision is better, as
C code is for programming computers, not for translating formulae into
machine readable form.

--
Check out Basic Algorithms and my other books:
https://www.lulu.com/spotlight/bgy1mm

Re: iso646.h

<uor1kv$1qh47$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.swapon.de!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: iso646.h
Date: Wed, 24 Jan 2024 13:00:16 +0000
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <uor1kv$1qh47$1@dont-email.me>
References: <uokhnk$eiln$1@dont-email.me> <uol92t$l82b$3@dont-email.me>
<uomjfr$sopf$1@dont-email.me> <uoopm9$1blvh$1@dont-email.me>
<uop0r1$1d4d4$1@dont-email.me> <uoqvas$1q40p$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 24 Jan 2024 13:00:16 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c2c105cd8d24f169cc51794302af1cd4";
logging-data="1918087"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18XUezaNHwfChQ6r9goqypgF5TTg0p9BRc="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:O9cNESUqwyFz6P92YVIUCUruXBY=
Content-Language: en-GB
In-Reply-To: <uoqvas$1q40p$1@dont-email.me>
 by: bart - Wed, 24 Jan 2024 13:00 UTC

On 24/01/2024 12:20, Malcolm McLean wrote:
> On 23/01/2024 18:34, bart wrote:
>> On 23/01/2024 16:32, Malcolm McLean wrote:
>>> On 22/01/2024 20:34, Lawrence D'Oliveiro wrote:
>>>> On Mon, 22 Jan 2024 09:30:21 +0100, David Brown wrote:
>>>>
>>>>> ... I don't use the matching names in C++ either ...
>>>>
>>>> I do, if/when I do use C++ and C. Don’t you think it improves
>>>> readability:
>>>>
>>> It breaks the rule that, in C, variables and functions are
>>> alphnumeric, whilst operators are symbols. sizeof is an exception,
>>> but a justified one. However it's harder to justify a symbol for
>>> "plus" but a word for "or".
>>
>> But it's OK to justify 'pow' for exponentiation?
>>
> Mathematically operators are functions, so a mathematican would say that
> "add" is just as much of a function as "gamma". But to a computer
> programmer an operator compiles to a trivial number of machine code
> instructions, whilst a function is a subroutine call. Pow is not usually
> supported in hardware. However it's such a basic mathematical function
> that it has special notation. So some languages say it should be an
> operator. However ASCII won't represent the standard notation.

Which is what? Usually the operator is implied when using mathematical
notation, as is multiply.

Computer languages commonly use '**' or '^' for this operator.

SO there
> are good arguments for and against pow as an operators, and different
> language take differnet views. But I think the C decision is better, as
> C code is for programming computers, not for translating formulae into
> machine readable form.

C's decision is possibly the worst. A proper built-in operator, say
'**', can be overloaded to work on both ints and floats.

If you do 'pow(a,3)' in C when 'a' is an integer, then it will convert
to a float, call the external function, and return a float result, which
is likely to force neighbouring terms and operators to work as floats too.

Using 'a**3', that would probably be a call to an integer power
function, but here it can also easily choose to do a*a*a.


devel / comp.lang.c / Re: iso646.h

Pages:1234567891011121314151617181920212223242526
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor