Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Prediction is very difficult, especially of the future. -- Niels Bohr


devel / comp.lang.c / 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

<uouf96$2em2l$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!rocksolid2!news.neodome.net!weretis.net!feeder8.news.weretis.net!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: Thu, 25 Jan 2024 21:11:18 +0100
Organization: A noiseless patient Spider
Lines: 76
Message-ID: <uouf96$2em2l$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> <uoqvas$1q40p$1@dont-email.me>
<uor4rf$1r10t$1@dont-email.me> <87frym7l3p.fsf@nosuchdomain.example.com>
<uot08a$278i2$1@dont-email.me> <uotmed$2ack6$2@dont-email.me>
<uoto3n$2an28$1@dont-email.me> <uou05d$2bvjr$2@dont-email.me>
<uou170$2c7ed$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 25 Jan 2024 20:11:18 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f683ae60830b70bfa20d120c06e7e3c5";
logging-data="2578517"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Ht64o5nPA2/TSTX8ONP8phe7LU8IT68w="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:TZJUCNQM0gzXtjUb737B+hPqU28=
In-Reply-To: <uou170$2c7ed$1@dont-email.me>
Content-Language: en-GB
 by: David Brown - Thu, 25 Jan 2024 20:11 UTC

On 25/01/2024 17:11, Janis Papanagnou wrote:
> On 25.01.2024 16:53, David Brown wrote:
>> On 25/01/2024 14:35, Janis Papanagnou wrote:
>>> On 25.01.2024 14:07, David Brown wrote:
>>>>
>>>> The problem was with the order of evaluation. Prior to C++17 (where it
>>>> was fixed), if you wrote "cout << one() << two() << three();", the order
>>>> the three functions were evaluated was unspecified.
>>>
>>> The last decade or two I haven't been in C++ to any depth. But I'm a bit
>>> surprised by that. The op<< is defined by something like [informally]
>>> stream op<<(stream,value), where "two() << three()" is "value << value",
>>> but "cout << one()" would yield a stream, say X, and "X << two()" again
>>> a stream, etc. So actually we have nested functions
>>> op<<( op<<( op<<(cout, one()), two()), three())
>>> At least you'd need to evaluate one() to obtain the argument for the
>>> next outer of the nested calls.
>>>
>>
>> Not quite. To simplify :
>>
>> cout << one() << two()
>>
>> is parsed as :
>>
>> (cout << one()) << two()
>>
>> So "cout << one()" is like a call to "op<<(cout, one())", and the full
>> expression is like :
>>
>> op<<(op<<(cout, one()), two())
>
> Yes, up to here that's exactly what I said above (with three nestings).
>
> op<<( op<<( op<<(cout, one()), two()), three())
>
> Remove one
>
> op<<( op<<(cout, one()), two())
>
>>
>> Without the new C++17 order of evaluation rules, the compiler can
>> happily execute "two()" before "op<<(cout, one())". The operands to the
>> outer call need to be executed before the outer call itself, but the
>> order in which these two operands are evaluated is unspecified (until
>> C++17).
>
> If that was formerly the case then the update was obviously necessary.
>
> Functionally there would probably have been commotion if
>
> tmp = op<<(cout, one())
> op<<( tmp, two())
>
> and
>
> op<<( op<<(cout, one()), two())
>
> would have had different results.
>
> Is or was there any compiler that implemented that in the "unexpected"
> order?
>

There were indeed such real-world cases, complaints were made, and the
rules changed in C++17.

Usually it doesn't matter what order arguments to functions (or operands
to operators) are evaluated. Some compilers have consistent ordering
(and it is often last to first, not first to last), others pick whatever
makes sense at the time. The ordering has been explicitly and clearly
stated as "unspecified" since around the beginning of time (which was,
as we all know, 01.01.1970).

Re: iso646.h

<uoufm9$2ei7i$4@dont-email.me>

  copy mid

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

  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: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Thu, 25 Jan 2024 20:18:17 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <uoufm9$2ei7i$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> <uoqvas$1q40p$1@dont-email.me>
<uor4rf$1r10t$1@dont-email.me> <87frym7l3p.fsf@nosuchdomain.example.com>
<20240124124839.903@kylheku.com> <uotm3h$2ack6$1@dont-email.me>
<87plxp47oo.fsf@nosuchdomain.example.com> <uouf2s$2em2l$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 25 Jan 2024 20:18:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a52c38d7852fe5be8309e2b943f36561";
logging-data="2574578"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18n0livWQmV70SLK+/bbXpM"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:NRSF3+nGXFTp/M0259MrGclfOP8=
 by: Lawrence D'Oliv - Thu, 25 Jan 2024 20:18 UTC

On Thu, 25 Jan 2024 21:07:55 +0100, David Brown wrote:

> This illustrates the two big difficulties with Unicode symbols for this
> kind of thing. Lots of them are difficult to type for many people (at
> least, not without a good deal of messing around or extra programs).

The compose key on *nix systems gives you a fairly mnemonic way of typing
many of them.

> And it's easy to have different symbols that appear quite similar as
> glyphs, but are very different characters as far as the compiler is
> concerned.

You can actually take advantage of that. E.g. from some of my Python code:

for cłass in (Window, Pixmap, Cursor, GContext, Region) :
delattr(cłass, "__del__")
#end for

The human reader might not actually notice (or care) that a particular
identifier looks like a reserved word, since the meaning is obvious from
context. The compiler cannot deduce the meaning from that context, but
then, it doesn’t need to.

Re: iso646.h

<MxzsN.122721$q3F7.88747@fx45.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx45.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: iso646.h
Newsgroups: comp.lang.c
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> <uor4rf$1r10t$1@dont-email.me> <87frym7l3p.fsf@nosuchdomain.example.com> <20240124124839.903@kylheku.com> <uotm3h$2ack6$1@dont-email.me> <87plxp47oo.fsf@nosuchdomain.example.com> <uouf42$2ei7i$3@dont-email.me>
Lines: 15
Message-ID: <MxzsN.122721$q3F7.88747@fx45.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Thu, 25 Jan 2024 20:30:36 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Thu, 25 Jan 2024 20:30:36 GMT
X-Received-Bytes: 1319
 by: Scott Lurndal - Thu, 25 Jan 2024 20:30 UTC

Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>On Thu, 25 Jan 2024 09:57:43 -0800, Keith Thompson wrote:
>
>> Then we'll have "x ↑ y", and no possible confusion.
>>
>> That's difficult to type
>
>Compose-circumflex-bar, or compose-bar-circumflex.

yep, difficult to type.

>
>↑↑ (typed by me)

and to read.

Re: iso646.h

<20240125125621.856@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Thu, 25 Jan 2024 21:04:39 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <20240125125621.856@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>
<uop0r1$1d4d4$1@dont-email.me> <uoqvas$1q40p$1@dont-email.me>
<uor4rf$1r10t$1@dont-email.me> <87frym7l3p.fsf@nosuchdomain.example.com>
<20240124124839.903@kylheku.com> <uotm3h$2ack6$1@dont-email.me>
<uouf0e$2ei7i$2@dont-email.me>
Injection-Date: Thu, 25 Jan 2024 21:04:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="64d741b4aedd1f2c9b80077e3ef47e46";
logging-data="2594121"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19lG3Zgl9as3gUu/7qmAlRD3Q5Q4393j/c="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:9fHDnzG6P9lLVVER8SsbtmLJjmI=
 by: Kaz Kylheku - Thu, 25 Jan 2024 21:04 UTC

On 2024-01-25, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
> On Thu, 25 Jan 2024 14:01:36 +0100, David Brown wrote:
>
>> I'm hoping the C++ people while do the sane/unthinkable (cross out one,
>> according to personal preference) thing and allow Unicode symbols for
>> operators, which will then be added to the standard library rather than
>> to the language.
>
> Why not do what Algol-68 did, and specify a set of characters that could
> be used to define new custom operators?

That ship sailed. C uses maximal munch lexing which allows operators
to be juxtaposed with no intervening space. E.g. !*++p is tokenized
as {!}{*}{++}{p}. It's difficult to introduce a scheme for defining
new combinations of characters as new kinds of tokens. The only
ASCII glyphs that are not some kind of token already are $ and @;
they are not used in C. So program-defined tokens would have to start
with one of these. If a program-defined token started with something
existing like *, for instance a token *%%*, that already has an existing
meaning; it scans as {*}{%}{%}{*}. Hacky rules, like speculative parses,
and whatnot, could make it work; there is now way something like that
could be standardized into C, though.

We can use *%%* as a symbol in ANSI Lisp, because Lisp has tokenizing
rules which support that. Tokens are made up of token constituent
characters, and are delimited by the first nonconstituent. For instance
( is a non-constituent (for obvious reasons) so *%%*( will be read
properly as the *%%* token (which becomes a symbol object) followed
by an open parenthesis starting a list. Likewise, whitespace is
terminating. The # character has a special meaning in various notations,
and is also a token constituent so that #c(1.0 2.0) is a complex
number, yet ab#c is a single symbol token.

Nothing like this is easy to retrofit into C.

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

Re: iso646.h

<20240125130525.907@kylheku.com>

  copy mid

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

  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: 433-929-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Thu, 25 Jan 2024 21:13:37 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <20240125130525.907@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>
<uop0r1$1d4d4$1@dont-email.me> <uoqvas$1q40p$1@dont-email.me>
<uor4rf$1r10t$1@dont-email.me> <87frym7l3p.fsf@nosuchdomain.example.com>
<20240124124839.903@kylheku.com> <uotm3h$2ack6$1@dont-email.me>
<87plxp47oo.fsf@nosuchdomain.example.com> <uouf42$2ei7i$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 25 Jan 2024 21:13:37 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="64d741b4aedd1f2c9b80077e3ef47e46";
logging-data="2594121"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19GEa8wsmqlD0aD38PlDRzmKG04+iOL6eM="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:h23oFvXlJVh+MNJj+QsDyLZL2QQ=
 by: Kaz Kylheku - Thu, 25 Jan 2024 21:13 UTC

On 2024-01-25, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
> On Thu, 25 Jan 2024 09:57:43 -0800, Keith Thompson wrote:
>
>> Then we'll have "x ↑ y", and no possible confusion.
>>
>> That's difficult to type
>
> Compose-circumflex-bar, or compose-bar-circumflex.
>
> ↑↑ (typed by me)

In Japanese IME: type ue, then space bar several times to find the
completion, which becomes the top one in the LRU list for the
next time you type ue.

Japanese IME is great.

Need an Ohm symbol? o-mu, spacebar: Ω. omega also works.

ha-to: ♥
onpu: ♪
hoshi: ★, ☆

arufa, be-ta, ganma, deruta, ...: α, β, γ, Δ

hidari: ← (and others)
migi: → (and others)
shita: ↓

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

Re: iso646.h

<uouj2u$2faug$1@dont-email.me>

  copy mid

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

  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: bc...@freeuk.com (bart)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Thu, 25 Jan 2024 21:16:14 +0000
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <uouj2u$2faug$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>
<uor4rf$1r10t$1@dont-email.me> <87frym7l3p.fsf@nosuchdomain.example.com>
<20240124124839.903@kylheku.com> <uotm3h$2ack6$1@dont-email.me>
<uouf0e$2ei7i$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 25 Jan 2024 21:16:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a096036155a64ccdd421fcbea0eaa216";
logging-data="2599888"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+UaxyJMKQ+50/MbFW60fEUNGvGO7FoMXM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:UpItTPwI31Yn78JkwJg0fS711SA=
Content-Language: en-GB
In-Reply-To: <uouf0e$2ei7i$2@dont-email.me>
 by: bart - Thu, 25 Jan 2024 21:16 UTC

On 25/01/2024 20:06, Lawrence D'Oliveiro wrote:
> On Thu, 25 Jan 2024 14:01:36 +0100, David Brown wrote:
>
>> I'm hoping the C++ people while do the sane/unthinkable (cross out one,
>> according to personal preference) thing and allow Unicode symbols for
>> operators, which will then be added to the standard library rather than
>> to the language.
>
> Why not do what Algol-68 did, and specify a set of characters that could
> be used to define new custom operators?

Because that was a terrible scheme. It was too easy to create a language
full of cryptic-looking new operators that no one had any idea what they
did.

It also allowed you to define precedences of any operator, including
overriding the precedence of any operator within a nested scope.

That means that 'a + b * c' could be parsed differently in different
contexts.

Imagine putting that power into the hands of ordinary users.

Re: iso646.h

<uoulon$2fp6j$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!rocksolid2!news.neodome.net!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: Thu, 25 Jan 2024 22:01:59 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <uoulon$2fp6j$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> <uoqvas$1q40p$1@dont-email.me>
<uor4rf$1r10t$1@dont-email.me> <87frym7l3p.fsf@nosuchdomain.example.com>
<20240124124839.903@kylheku.com> <uotm3h$2ack6$1@dont-email.me>
<uouf0e$2ei7i$2@dont-email.me> <uouj2u$2faug$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 25 Jan 2024 22:01:59 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a52c38d7852fe5be8309e2b943f36561";
logging-data="2614483"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18R8i0scqLEyTJzFWWmgYg9"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:5UqKhDChN8qvrW6rrdNLNtB379c=
 by: Lawrence D'Oliv - Thu, 25 Jan 2024 22:01 UTC

On Thu, 25 Jan 2024 21:16:14 +0000, bart wrote:

> Imagine putting that power into the hands of ordinary users.

Shock, horror. Of course we elite cannot allow that into the hands of the
plebs. Imagine what they might do!

Re: Python (Re: iso646.h)

<pan$b0262$ece0cff0$8c067108$484d6598@invalid.invalid>

  copy mid

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

  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!bluemanedhawk.eternal-september.org!.POSTED!not-for-mail
From: bluemane...@invalid.invalid (Blue-Maned_Hawk)
Newsgroups: comp.lang.c
Subject: Re: Python (Re: iso646.h)
Date: Thu, 25 Jan 2024 22:55:44 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <pan$b0262$ece0cff0$8c067108$484d6598@invalid.invalid>
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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 25 Jan 2024 22:55:44 -0000 (UTC)
Injection-Info: bluemanedhawk.eternal-september.org; posting-host="3085131c6ec2e03abe51cf88e7b94f27";
logging-data="2617370"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+g4YzBBITcEd9a1uCgyYOs824qU0n4DJc="
User-Agent: Pan/0.154 (Izium; 517acf4)
Cancel-Lock: sha1:lJk1p109ePClfCHLn3/GAM4BnYI=
X-Face: Llanfair­pwllgwyngyllÃ
ƒ‚Ã
ƒƒ‚­gogery­chwyrnÃ
ƒƒ
? ?‚­drobwll­llan
Ã
? ?ƒƒ‚­tysilio­go
g
o­goch
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACh0lEQVRYw71Z21bD
MAzzevbfkr4cHjrSXJyL044+MDa6WLEl2SkvkrZ1AbAvXO+bUGSCPYnsuIVGMpm
ZLnjX718GhAKNsp8lON2F9VrhELwIgJlBepkZjA78rVK+FkmNhEJK76UsJlz8+E
rJsjrpYouhLo/SC6qPHgakFOR8wV9+8rCfO/I/oVnmUZUp42/LW2XkLj9TCFNM9
jp5g2EmHZgpYZjCOkYU7sXVogRylJqpdggoFLG1g09Flah/7kErCxzR9HgXPYsq
0glb9cxjIz2Vsk9AmAoCSxECpD713joMKjQqLAtmMqJmXjdVvlMnMQCVITotJd1
z+fh1f1NNo+vuc1KnhWUmY7t03vydTud9BbXCtN3L2PL3bK7JCNG0GHzuZxafyB
fxevCxpm1vrwZltqw6SILCcdoCE6PGQC8wZWDA9Or7Qp5s3lAZezys0nDazs9S9
R0TjwEiksRxLkNPC1NMMWPs1bj0Ei0Yuo+JVtFLuzP1NRJ16qXWN8DhhtmS4PDg
O6mqRxs4bEJrYt087mSIow/1VzW2oFlMQuiuIy/KsUagvhdw6hSjJGlIavbLF8x
j3X47bccLcUSi0dkWh1nUZNhANT1tHKUXrNxNLbd9KPb9wDDVrKwmPQMOPQ1oy6
k5I1DwzDeRJd3jVIhDAUxq3ngzJG4CCkNXZxZVMcjefoK2J0gUY2S3rxz/RuTFx
2zHd9U+obimJXMG4edsk/2j5pTU5G1MmzbRLxkfq5EiT1GGsidvMGzi+1goGb2l
GCrN+nGnV8xj3q3JLRDVPL96vUc7Z4aJ3TN1mVqWAMJMfG+Jxh6TQqP+92iZkCU
xtglds1AB6r0aiSHKcnFck+p/c/0CbacFLQcajGcAAAAASUVORK5CYII=
 by: Blue-Maned_Hawk - Thu, 25 Jan 2024 22:55 UTC

Kalevi Kolttonen wrote:

> 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?

Frankly, i would like to see that kind of thing adopted everywhere.
Private variables, static subroutines, and opaque types are all things
that serve only to forcibly restrict a programmer. Instead of putting up
a barrier that can be hopped over when it's really necessary, they
establish a thick, unclimbable wall that can never be bypassed even when
you need to.

--
Blue-Maned_Hawk│shortens to
Hawk│/
blu.mɛin.dÊ°ak/
│he/him/his/himself/Mr.
blue-maned_hawk.srht.site

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

<pan$73b43$53f2696b$6076eb2e$f9a19083@invalid.invalid>

  copy mid

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

  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!bluemanedhawk.eternal-september.org!.POSTED!not-for-mail
From: bluemane...@invalid.invalid (Blue-Maned_Hawk)
Newsgroups: comp.lang.c
Subject: Re: C/CPP macro conventions (was Re: iso646.h)
Date: Thu, 25 Jan 2024 23:05:25 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <pan$73b43$53f2696b$6076eb2e$f9a19083@invalid.invalid>
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: Thu, 25 Jan 2024 23:05:25 -0000 (UTC)
Injection-Info: bluemanedhawk.eternal-september.org; posting-host="c6049b07092bfe4c28f549fcdb125562";
logging-data="2617370"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+42eD9pxn4RFv+7iz1+Nt9YVntu//LYW4="
User-Agent: Pan/0.154 (Izium; 517acf4)
Cancel-Lock: sha1:uI9z8zXEOYEiZ+KcEbvfpFtQ4Wc=
X-Face: Llanfair­pwllgwyngyllÃ
ƒ‚Ã
ƒƒ‚­gogery­chwyrnÃ
ƒƒ
? ?‚­drobwll­llan
Ã
? ?ƒƒ‚­tysilio­go
g
o­goch
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACh0lEQVRYw71Z21bD
MAzzevbfkr4cHjrSXJyL044+MDa6WLEl2SkvkrZ1AbAvXO+bUGSCPYnsuIVGMpm
ZLnjX718GhAKNsp8lON2F9VrhELwIgJlBepkZjA78rVK+FkmNhEJK76UsJlz8+E
rJsjrpYouhLo/SC6qPHgakFOR8wV9+8rCfO/I/oVnmUZUp42/LW2XkLj9TCFNM9
jp5g2EmHZgpYZjCOkYU7sXVogRylJqpdggoFLG1g09Flah/7kErCxzR9HgXPYsq
0glb9cxjIz2Vsk9AmAoCSxECpD713joMKjQqLAtmMqJmXjdVvlMnMQCVITotJd1
z+fh1f1NNo+vuc1KnhWUmY7t03vydTud9BbXCtN3L2PL3bK7JCNG0GHzuZxafyB
fxevCxpm1vrwZltqw6SILCcdoCE6PGQC8wZWDA9Or7Qp5s3lAZezys0nDazs9S9
R0TjwEiksRxLkNPC1NMMWPs1bj0Ei0Yuo+JVtFLuzP1NRJ16qXWN8DhhtmS4PDg
O6mqRxs4bEJrYt087mSIow/1VzW2oFlMQuiuIy/KsUagvhdw6hSjJGlIavbLF8x
j3X47bccLcUSi0dkWh1nUZNhANT1tHKUXrNxNLbd9KPb9wDDVrKwmPQMOPQ1oy6
k5I1DwzDeRJd3jVIhDAUxq3ngzJG4CCkNXZxZVMcjefoK2J0gUY2S3rxz/RuTFx
2zHd9U+obimJXMG4edsk/2j5pTU5G1MmzbRLxkfq5EiT1GGsidvMGzi+1goGb2l
GCrN+nGnV8xj3q3JLRDVPL96vUc7Z4aJ3TN1mVqWAMJMfG+Jxh6TQqP+92iZkCU
xtglds1AB6r0aiSHKcnFck+p/c/0CbacFLQcajGcAAAAASUVORK5CYII=
 by: Blue-Maned_Hawk - Thu, 25 Jan 2024 23:05 UTC

I think that macros should always be shouted, regardless of context,
because as nothing but text replacements they are inherently a little more
spicy to deal with and functionlikemacros are not always interchangeäble
with subroutine calls—for instance, one cannot take the address of a
functionlikemacro like they can with a subroutine.

On the other hand, i've seen instances of people making certain
exceptionally bizzare macros lowercase despite how weird the macros are—
see, for instance, the black magic that is <https://www.libcello.org/>.

--
Blue-Maned_Hawk│shortens to
Hawk│/
blu.mɛin.dÊ°ak/
│he/him/his/himself/Mr.
blue-maned_hawk.srht.site
East, west, and C!

Operators (Algol 68) (was Re: iso646.h)

<uov0lq$2hbbs$1@dont-email.me>

  copy mid

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

  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: Operators (Algol 68) (was Re: iso646.h)
Date: Fri, 26 Jan 2024 02:08:09 +0100
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <uov0lq$2hbbs$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>
<uor4rf$1r10t$1@dont-email.me> <87frym7l3p.fsf@nosuchdomain.example.com>
<20240124124839.903@kylheku.com> <uotm3h$2ack6$1@dont-email.me>
<uouf0e$2ei7i$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 26 Jan 2024 01:08:10 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5f313c2ddb3d78962b0536ef126cc20d";
logging-data="2665852"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/v3fzXXtAOMMTgtGZhM+rh"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:/R5HKYM+bGDae/gUv3oY4TZ89sc=
In-Reply-To: <uouf0e$2ei7i$2@dont-email.me>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Fri, 26 Jan 2024 01:08 UTC

On 25.01.2024 21:06, Lawrence D'Oliveiro wrote:
>
> Why not do what Algol-68 did, and specify a set of characters that could
> be used to define new custom operators?

What do you mean by "specify a set of characters that could be used"?

In Algol(68) you can use punctuation characters, letters, or words.
Just declare the operator and its priority.

A few examples from some old test source code on my disk...

OP H = (INT a, b) INT : ( a+b );
PRIO H = 5;
OP ~ = (INT a, b) INT : ( a+b );
PRIO ~ = 5;
IF 2 H 3 = 5 THEN print (62) ELSE print (63) FI;
IF 2 ~ 3 = 5 THEN print (72) ELSE print (73) FI;

PRIO O = 9;
OP O = (INT a, b) INT : a * b;
print ((a O b + 1))

OP MAX = (INT a, INT b) INT : ( a > b | a | b );
PRIO MAX = 4;
print (5 MAX 7);

Janis

Re: iso646.h

<uov0rv$2hbbs$2@dont-email.me>

  copy mid

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

  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: Fri, 26 Jan 2024 02:11:27 +0100
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <uov0rv$2hbbs$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> <uoqvas$1q40p$1@dont-email.me>
<uor4rf$1r10t$1@dont-email.me> <87frym7l3p.fsf@nosuchdomain.example.com>
<20240124124839.903@kylheku.com> <uotm3h$2ack6$1@dont-email.me>
<uouf0e$2ei7i$2@dont-email.me> <uouj2u$2faug$1@dont-email.me>
<uoulon$2fp6j$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 26 Jan 2024 01:11:27 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5f313c2ddb3d78962b0536ef126cc20d";
logging-data="2665852"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19dM5n4X1M0WLIxceVKjcw6"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:5q5X6gqvDhbfhCyPBTH0pKJ4fMk=
In-Reply-To: <uoulon$2fp6j$2@dont-email.me>
 by: Janis Papanagnou - Fri, 26 Jan 2024 01:11 UTC

On 25.01.2024 23:01, Lawrence D'Oliveiro wrote:
> On Thu, 25 Jan 2024 21:16:14 +0000, bart wrote:
>
>> Imagine putting that power into the hands of ordinary users.
>
> Shock, horror. Of course we elite cannot allow that into the hands of the
> plebs. Imagine what they might do!

Power to the people!

Janis

Re: iso646.h

<20240125171931.739@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Fri, 26 Jan 2024 01:19:43 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <20240125171931.739@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>
<uop0r1$1d4d4$1@dont-email.me> <uoqvas$1q40p$1@dont-email.me>
<uor4rf$1r10t$1@dont-email.me> <87frym7l3p.fsf@nosuchdomain.example.com>
<20240124124839.903@kylheku.com> <uotm3h$2ack6$1@dont-email.me>
<uouf0e$2ei7i$2@dont-email.me> <uouj2u$2faug$1@dont-email.me>
<uoulon$2fp6j$2@dont-email.me> <uov0rv$2hbbs$2@dont-email.me>
Injection-Date: Fri, 26 Jan 2024 01:19:43 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="96ca4eb75b4703d7855e1ee0c9e2d747";
logging-data="2668332"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18WFersVRQzVpVySDQqglovpdPBH86Qu8E="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:+eAO2vFId1cFH10RPfKXVc0UsYc=
 by: Kaz Kylheku - Fri, 26 Jan 2024 01:19 UTC

On 2024-01-26, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
> On 25.01.2024 23:01, Lawrence D'Oliveiro wrote:
>> On Thu, 25 Jan 2024 21:16:14 +0000, bart wrote:
>>
>>> Imagine putting that power into the hands of ordinary users.
>>
>> Shock, horror. Of course we elite cannot allow that into the hands of the
>> plebs. Imagine what they might do!
>
> Power to the people!

And through the chairs of bad people!

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

Re: iso646.h

<uov1f5$2heei$1@dont-email.me>

  copy mid

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

  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: Fri, 26 Jan 2024 02:21:41 +0100
Organization: A noiseless patient Spider
Lines: 97
Message-ID: <uov1f5$2heei$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>
<uor4rf$1r10t$1@dont-email.me> <87frym7l3p.fsf@nosuchdomain.example.com>
<uot08a$278i2$1@dont-email.me> <uotmed$2ack6$2@dont-email.me>
<uoto3n$2an28$1@dont-email.me> <uou05d$2bvjr$2@dont-email.me>
<uou170$2c7ed$1@dont-email.me> <uouf96$2em2l$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 26 Jan 2024 01:21:41 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5f313c2ddb3d78962b0536ef126cc20d";
logging-data="2669010"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+EWW/mpyZe1zRyT4TLA64o"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:lENlvSGSBtaINWwh9Oq03Jr9bbM=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <uouf96$2em2l$2@dont-email.me>
 by: Janis Papanagnou - Fri, 26 Jan 2024 01:21 UTC

On 25.01.2024 21:11, David Brown wrote:
> On 25/01/2024 17:11, Janis Papanagnou wrote:
>> On 25.01.2024 16:53, David Brown wrote:
>>> On 25/01/2024 14:35, Janis Papanagnou wrote:
>>>> On 25.01.2024 14:07, David Brown wrote:
>>>>>
>>>>> The problem was with the order of evaluation. Prior to C++17
>>>>> (where it
>>>>> was fixed), if you wrote "cout << one() << two() << three();", the
>>>>> order
>>>>> the three functions were evaluated was unspecified.
>>>>
>>>> The last decade or two I haven't been in C++ to any depth. But I'm a
>>>> bit
>>>> surprised by that. The op<< is defined by something like [informally]
>>>> stream op<<(stream,value), where "two() << three()" is "value <<
>>>> value",
>>>> but "cout << one()" would yield a stream, say X, and "X << two()" again
>>>> a stream, etc. So actually we have nested functions
>>>> op<<( op<<( op<<(cout, one()), two()), three())
>>>> At least you'd need to evaluate one() to obtain the argument for the
>>>> next outer of the nested calls.
>>>>
>>>
>>> Not quite. To simplify :
>>>
>>> cout << one() << two()
>>>
>>> is parsed as :
>>>
>>> (cout << one()) << two()
>>>
>>> So "cout << one()" is like a call to "op<<(cout, one())", and the full
>>> expression is like :
>>>
>>> op<<(op<<(cout, one()), two())
>>
>> Yes, up to here that's exactly what I said above (with three nestings).
>>
>> op<<( op<<( op<<(cout, one()), two()), three())
>>
>> Remove one
>>
>> op<<( op<<(cout, one()), two())
>>
>>>
>>> Without the new C++17 order of evaluation rules, the compiler can
>>> happily execute "two()" before "op<<(cout, one())". The operands to the
>>> outer call need to be executed before the outer call itself, but the
>>> order in which these two operands are evaluated is unspecified (until
>>> C++17).
>>
>> If that was formerly the case then the update was obviously necessary.
>>
>> Functionally there would probably have been commotion if
>>
>> tmp = op<<(cout, one())
>> op<<( tmp, two())
>>
>> and
>>
>> op<<( op<<(cout, one()), two())
>>
>> would have had different results.
>>
>> Is or was there any compiler that implemented that in the "unexpected"
>> order?
>>
>
> There were indeed such real-world cases, complaints were made,

Complaints that the rule was not clear in its definition?
Or complaints that their compiler did not support cout<<a<<b<<c;
correctly? - I would be astonished about the latter.
This is so fundamental a construct and so frequently used that any
compiler would have been withdrawn in the week after it came out.
That is my expectation. So I would be grateful if you could provide
some evidence that I can look up.

Mind that even if two() is evaluated before one(), it will not be
output before the stream of the first expression op<<(cout, one())
is available, and for this one() must be evaluated. Then one() can
be sent to the stream, and then also two() can be sent to the stream.
(Am I missing something?)

Janis

> and the rules changed in C++17.
>
> Usually it doesn't matter what order arguments to functions (or operands
> to operators) are evaluated. Some compilers have consistent ordering
> (and it is often last to first, not first to last), others pick whatever
> makes sense at the time. The ordering has been explicitly and clearly
> stated as "unspecified" since around the beginning of time (which was,
> as we all know, 01.01.1970).

Re: iso646.h

<up07tb$2qm2c$1@dont-email.me>

  copy mid

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

  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: malcolm....@gmail.com (Malcolm McLean)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Fri, 26 Jan 2024 12:17:46 +0000
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <up07tb$2qm2c$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>
<uor4rf$1r10t$1@dont-email.me> <uorolm$1uaut$1@dont-email.me>
<uotnnt$2akq3$1@dont-email.me> <uou1lg$2c9us$1@dont-email.me>
<875xzh43us.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 26 Jan 2024 12:17:48 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="27f1727a16c4aa0424b8850932dfd0ab";
logging-data="2971724"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ukchdB5r8DJ0G7Z5idciPXiueFRDh7K0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:wZiTYR0oaZiTWIvfIPuyL5QwOqU=
In-Reply-To: <875xzh43us.fsf@nosuchdomain.example.com>
Content-Language: en-GB
 by: Malcolm McLean - Fri, 26 Jan 2024 12:17 UTC

On 25/01/2024 19:20, Keith Thompson wrote:
> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
> [...]
>> No, that's very useful. If you are thinking in a formal, mathematical way.
>> A "Malcolm" function is a function of bits. So sizeof is also not a
>> Malcolm function. Whilst the output set is bits (in the Malcolm
>> function definition, before optimisation, this is normally a minor
>> caveat but not for sizeof), the input set is the domain of tyes and
>> expressions and not bits.
>> But it is definitely a function, in the proper sense of the term. That
>> C misuses the word is unfortunate, and whilst we have to accept that
>> the word will be misused in this way in a C context, I don't think
>> that means we must always misuse it, even when talking about C.
> [...]
>
> You insist that the proper meaning of "function" can only be what
> you say it is. That's what a lot of us find tedious and misleading.
>
> According to dictionary.com, the English word "function" goes back to
> the 1500s with the meaning "a performance, execution". The mathematical
> meaning presumably came later (and mathematical terminology can be quite
> flexible, often defined in an ad hoc manner within a paper).
>
> Different fields define different meanings for domain-specific terms,
> often using English words that have existing meanings. Mathematicians
> introduced their own meaning(s) for the existing word "function".
> Computer scientists did the same, with a meaning based on the
> mathematical meaning but evolving to refer to how a function is
> implemented in a particular language. In everyday English, "function"
> often means something like "purpose". C has a very precise meaning for
> the word "function" that differs from the mathematical meaning -- **and
> there is nothing wrong with that**.
>
> You don't like it? That's fine, but consider trying to communicate
> clearly anyway. Feel free to use terms like "mathematical function",
> "pure function", or even "Malcolm function" if you insist. But if you
> use the unqualified word "function" with a different meaning while
> talking about C, you'll get the negative feedback that I can only assume
> you're looking for.
>
We could say that in comp.lang.c "function" shall mean "a subroutine"
and carry no other meaning. But then either we can't talk about
subroutines which calculate "functions" [prohibited word] of bits at
all, which isn't really an acceptable restriction, or we have to invent
another term. So "Malcolm function" is workable, but has the disadvantge
that whilst regulars know what a "Malcolm function" is, the term is not
going to be familiar to anyone coming to the group for the first time,
and that "Malcolm functions" are just subroutines which are mathematical
functions". Essentially. Another advantage of "Maclolm function" is that
if we have this special term, we can define it in away which is slightly
different from "mathematical function", and that can help clarify ideas.

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

Re: Python (Re: iso646.h)

<86y1cccija.fsf@linuxsc.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: Python (Re: iso646.h)
Date: Fri, 26 Jan 2024 05:48:25 -0800
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <86y1cccija.fsf@linuxsc.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> <uop48a$1dmoe$1@dont-email.me> <uopclb$1f17i$7@dont-email.me> <uopfm2$1fj5r$1@dont-email.me> <uopik4$1fs5l$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="3fb740dc5d2d937efa44f2af60b1195d";
logging-data="3000170"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19EaTIAnPJrBADHLtOjdz1Zd1j3shids1s="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:Y2BGnaKJSFGyUO8gsP8a9QJ8+ZM=
sha1:8s1OsdW1Ep6p5LhAz282JU8v/EM=
 by: Tim Rentsch - Fri, 26 Jan 2024 13:48 UTC

Lawrence D'Oliveiro <ldo@nz.invalid> writes:

> On Tue, 23 Jan 2024 22:47:30 -0000 (UTC), Kalevi Kolttonen wrote:
>
>> 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?

I have to admit, this question made me laugh.

> [...]
> Python also has metaclasses. Does your favourite OO language have
> metaclasses?

It does.

But this being comp.lang.c, I am confining my remarks to
commentary related to C.

Re: iso646.h

<up0hbv$2tdei$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.1d4.us!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: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Fri, 26 Jan 2024 15:59:11 +0100
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <up0hbv$2tdei$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>
<uor4rf$1r10t$1@dont-email.me> <87frym7l3p.fsf@nosuchdomain.example.com>
<20240124124839.903@kylheku.com> <uotm3h$2ack6$1@dont-email.me>
<87plxp47oo.fsf@nosuchdomain.example.com> <uouf2s$2em2l$1@dont-email.me>
<uoufm9$2ei7i$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 26 Jan 2024 14:59:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5275502989ed94a21b07f0e0ca598467";
logging-data="3061202"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/mpHDicYKqg6UaAej1dANEW5ANNdlULk8="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:OuXJQ9uknJ1bM9RevsScDX3bfFk=
In-Reply-To: <uoufm9$2ei7i$4@dont-email.me>
Content-Language: en-GB
 by: David Brown - Fri, 26 Jan 2024 14:59 UTC

On 25/01/2024 21:18, Lawrence D'Oliveiro wrote:
> On Thu, 25 Jan 2024 21:07:55 +0100, David Brown wrote:
>
>> This illustrates the two big difficulties with Unicode symbols for this
>> kind of thing. Lots of them are difficult to type for many people (at
>> least, not without a good deal of messing around or extra programs).
>
> The compose key on *nix systems gives you a fairly mnemonic way of typing
> many of them.
>

It lets you type some, but it is still limited in the default setup.
It's very useful for things like diacriticals on letters that you
already have, but if you want to use it for something out of the
ordinary, you need to make your own .XCompose file. And then you have
to remember to update things on your home computer, work computer,
laptop, etc. So it is very useful (I use it myself), but not an
out-of-the-box solution.

>> And it's easy to have different symbols that appear quite similar as
>> glyphs, but are very different characters as far as the compiler is
>> concerned.
>
> You can actually take advantage of that. E.g. from some of my Python code:
>
> for cłass in (Window, Pixmap, Cursor, GContext, Region) :
> delattr(cłass, "__del__")
> #end for
>
> The human reader might not actually notice (or care) that a particular
> identifier looks like a reserved word, since the meaning is obvious from
> context. The compiler cannot deduce the meaning from that context, but
> then, it doesn’t need to.

I am not at all keen on that. I am not against using non-ASCII letters
as though they were special symbols for particular purposes, but I'd
want them to stand out clearly.

Re: iso646.h

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

  copy mid

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

  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: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Fri, 26 Jan 2024 07:56:40 -0800
Organization: None to speak of
Lines: 68
Message-ID: <87h6j02imf.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> <uoqvas$1q40p$1@dont-email.me>
<uor4rf$1r10t$1@dont-email.me> <uorolm$1uaut$1@dont-email.me>
<uotnnt$2akq3$1@dont-email.me> <uou1lg$2c9us$1@dont-email.me>
<875xzh43us.fsf@nosuchdomain.example.com>
<up07tb$2qm2c$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="8f39831f746400b49513f5e46ff4c868";
logging-data="3084513"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18viDGtLVoq53miaRc3w+GW"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:9p+AWaCm7Cqqe/PCKmKX2amyOeM=
sha1:7VhxKYSjuBcEJ2J6Pp5MeeQM8hw=
 by: Keith Thompson - Fri, 26 Jan 2024 15:56 UTC

Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
> On 25/01/2024 19:20, Keith Thompson wrote:
>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
>> [...]
>>> No, that's very useful. If you are thinking in a formal, mathematical way.
>>> A "Malcolm" function is a function of bits. So sizeof is also not a
>>> Malcolm function. Whilst the output set is bits (in the Malcolm
>>> function definition, before optimisation, this is normally a minor
>>> caveat but not for sizeof), the input set is the domain of tyes and
>>> expressions and not bits.
>>> But it is definitely a function, in the proper sense of the term. That
>>> C misuses the word is unfortunate, and whilst we have to accept that
>>> the word will be misused in this way in a C context, I don't think
>>> that means we must always misuse it, even when talking about C.
>> [...]
>> You insist that the proper meaning of "function" can only be what
>> you say it is. That's what a lot of us find tedious and misleading.
>> According to dictionary.com, the English word "function" goes back
>> to
>> the 1500s with the meaning "a performance, execution". The mathematical
>> meaning presumably came later (and mathematical terminology can be quite
>> flexible, often defined in an ad hoc manner within a paper).
>> Different fields define different meanings for domain-specific
>> terms,
>> often using English words that have existing meanings. Mathematicians
>> introduced their own meaning(s) for the existing word "function".
>> Computer scientists did the same, with a meaning based on the
>> mathematical meaning but evolving to refer to how a function is
>> implemented in a particular language. In everyday English, "function"
>> often means something like "purpose". C has a very precise meaning for
>> the word "function" that differs from the mathematical meaning -- **and
>> there is nothing wrong with that**.
>> You don't like it? That's fine, but consider trying to communicate
>> clearly anyway. Feel free to use terms like "mathematical function",
>> "pure function", or even "Malcolm function" if you insist. But if you
>> use the unqualified word "function" with a different meaning while
>> talking about C, you'll get the negative feedback that I can only assume
>> you're looking for.
>>
> We could say that in comp.lang.c "function" shall mean "a subroutine"
> and carry no other meaning. But then either we can't talk about
> subroutines which calculate "functions" [prohibited word] of bits at
> all, which isn't really an acceptable restriction, or we have to
> invent another term. So "Malcolm function" is workable, but has the
> disadvantge that whilst regulars know what a "Malcolm function" is,
> the term is not going to be familiar to anyone coming to the group for
> the first time, and that "Malcolm functions" are just subroutines
> which are mathematical functions". Essentially. Another advantage of
> "Maclolm function" is that if we have this special term, we can define
> it in away which is slightly different from "mathematical function",
> and that can help clarify ideas.

Is there any difference between what you call a "Malcolm function" and
what most people would call a "pure function" (a function that returns
the same result for the same arguments and has no side effects)?

Nobody is trying to forbid anything. I'm just saying that the word
"function" when used without qualification should refer to what C calls
a "function". If you mean something other than a C function, just
qualify the word somehow so we know what you're talking about.

We know you don't like the way C uses the word "function". You don't
need to tell us again and again.

--
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

<up0l1l$2u6hl$1@dont-email.me>

  copy mid

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

  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: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Fri, 26 Jan 2024 17:01:57 +0100
Organization: A noiseless patient Spider
Lines: 97
Message-ID: <up0l1l$2u6hl$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>
<uor4rf$1r10t$1@dont-email.me> <87frym7l3p.fsf@nosuchdomain.example.com>
<uot08a$278i2$1@dont-email.me> <uotmed$2ack6$2@dont-email.me>
<uoto3n$2an28$1@dont-email.me> <uou05d$2bvjr$2@dont-email.me>
<uou170$2c7ed$1@dont-email.me> <uouf96$2em2l$2@dont-email.me>
<uov1f5$2heei$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 26 Jan 2024 16:01:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5275502989ed94a21b07f0e0ca598467";
logging-data="3086901"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+f/zJoS8EJdBjXBk1PcyXpA1x30o2d6d8="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:iShUxYMIyqByg5xQsCgPhapMZ6E=
Content-Language: en-GB
In-Reply-To: <uov1f5$2heei$1@dont-email.me>
 by: David Brown - Fri, 26 Jan 2024 16:01 UTC

On 26/01/2024 02:21, Janis Papanagnou wrote:
> On 25.01.2024 21:11, David Brown wrote:
>> On 25/01/2024 17:11, Janis Papanagnou wrote:

>>> Is or was there any compiler that implemented that in the "unexpected"
>>> order?
>>>
>>
>> There were indeed such real-world cases, complaints were made,
>
> Complaints that the rule was not clear in its definition?
> Or complaints that their compiler did not support cout<<a<<b<<c;
> correctly? - I would be astonished about the latter.

The pre-C++17 rule was perfectly clear - there was no specified order of
execution for the operands. (And I thought I'd made /that/ perfectly
clear already.) Compilers all worked correctly - they can hardly have
fallen foul of a rule that did not exist.

The complaints (at least, the ones based on facts rather than
misunderstandings) were about the lack of a rule that enforced
evaluation order in certain cases.

So C++17 added rules for evaluation orders in some circumstances, but
not others. In C++17, but not before (and not in C), the evaluation of
the expression "one" (and any side-effects) must come before the
evaluation of "two" for, amongst other things :

one << two
one >> two
one[two]
two = one

There is still /no/ ordering for

one * two
one + two

and many other cases.

And of course there are cases where there has always been a sequence
point, and therefore an order of evaluation (a logical order, that is -
if the compiler can see it makes no difference to the observable
effects, it can always re-arrange anything).

<https://en.cppreference.com/w/cpp/language/eval_order>
<https://en.cppreference.com/w/c/language/eval_order>

> This is so fundamental a construct and so frequently used that any
> compiler would have been withdrawn in the week after it came out.
> That is my expectation. So I would be grateful if you could provide
> some evidence that I can look up.

<https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0145r3.pdf>

For an example in practice, where you can see the generated assembly:

<https://www.godbolt.org/z/fWezzx1nd>

If I remember correctly, gcc 7 implemented the ordering rules from C++17
and back-ported them to previous C++ standards for user convenience (as
the order was previously unspecified, it was fine to do that).

Look at the generated assembly and the order in which the calls to
one(), two(), three() and four() are made. For the operator "<<", they
are made in order one() to four(). For the operator "+", and for
function call parameters, they are generated in order four() to one()
for this case. (In other cases, that may be different - that's what
"unspecified" means.)

>
> Mind that even if two() is evaluated before one(), it will not be
> output before the stream of the first expression op<<(cout, one())
> is available, and for this one() must be evaluated. Then one() can
> be sent to the stream, and then also two() can be sent to the stream.
> (Am I missing something?)

The output to the stream must be in the order given in the code - that
is true. But the values to be output could (prior to C++17) be
evaluated in any order. If one() and two() have side-effects, that is
critical - those side-effects could be executed in any order.

>
> Janis
>
>> and the rules changed in C++17.
>>
>> Usually it doesn't matter what order arguments to functions (or operands
>> to operators) are evaluated. Some compilers have consistent ordering
>> (and it is often last to first, not first to last), others pick whatever
>> makes sense at the time. The ordering has been explicitly and clearly
>> stated as "unspecified" since around the beginning of time (which was,
>> as we all know, 01.01.1970).
>
>

Re: iso646.h

<up0lab$2u6hl$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!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: Fri, 26 Jan 2024 17:06:35 +0100
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <up0lab$2u6hl$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> <uoqvas$1q40p$1@dont-email.me>
<uor4rf$1r10t$1@dont-email.me> <uorolm$1uaut$1@dont-email.me>
<uotnnt$2akq3$1@dont-email.me> <uou1lg$2c9us$1@dont-email.me>
<875xzh43us.fsf@nosuchdomain.example.com> <up07tb$2qm2c$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 26 Jan 2024 16:06:35 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5275502989ed94a21b07f0e0ca598467";
logging-data="3086901"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/thuQYsOaNT4DkbpTOfw3f9DjDuUt+Ftk="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:NM2IrH1J50j94GJ6PfqozaLbsEU=
Content-Language: en-GB
In-Reply-To: <up07tb$2qm2c$1@dont-email.me>
 by: David Brown - Fri, 26 Jan 2024 16:06 UTC

On 26/01/2024 13:17, Malcolm McLean wrote:

> We could say that in comp.lang.c "function" shall mean "a subroutine"

<snip the blather>

Why don't we just say - as everyone in this group except you already
says, that in c.l.c. "function" means "C function" as described in the C
standards, and any other type of function needs to be qualified?

Thus "the tan function" here means the function from <math.h>, not the
mathematical function, or something done when making leather.

It really is not difficult.

Re: iso646.h

<up0lld$2u6hl$3@dont-email.me>

  copy mid

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

  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: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Fri, 26 Jan 2024 17:12:29 +0100
Organization: A noiseless patient Spider
Lines: 66
Message-ID: <up0lld$2u6hl$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>
<uopcd0$1f17i$4@dont-email.me> <uorpir$1ufp8$1@dont-email.me>
<87r0i65w9u.fsf@nosuchdomain.example.com> <uoslj6$261n4$1@dont-email.me>
<8734um5ai7.fsf@nosuchdomain.example.com> <uotb6u$28mtf$1@dont-email.me>
<uotqle$2b460$1@dont-email.me> <87ttn14epe.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 26 Jan 2024 16:12:29 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5275502989ed94a21b07f0e0ca598467";
logging-data="3086901"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+e/dRyqk5KCYTMO/g4qFwiVeASBZ+yW9A="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:hp3GsdpEMinYjmafmkAY8WUmHa0=
Content-Language: en-GB
In-Reply-To: <87ttn14epe.fsf@nosuchdomain.example.com>
 by: David Brown - Fri, 26 Jan 2024 16:12 UTC

On 25/01/2024 16:26, Keith Thompson wrote:
> David Brown <david.brown@hesbynett.no> writes:
>> On 25/01/2024 10:55, Malcolm McLean wrote:
>>> On 25/01/2024 03:59, Keith Thompson wrote:
>>
>>>> As for K&R's thinking, I have no particular insight on that.  I have no
>>>> problem with some operators being represented by symbols and others by
>>>> keywords (I'm accustomed to it from other languages), and I don't see
>>>> that the decision to make "sizeof" a keyword even requires any
>>>> justification.
>>>>
>>> I looked it up on the web, but I can't find anything that goes back
>>> to K and R and explains why they took that decision. But clearly to
>>> use a word rather than punctuators, as was the case with every other
>>> operator, must have had a reason.
>>
>>> I think they wanted it to look function-like, because it is
>>> function, though a function of a type rather than of bits, so of
>>> course not a "function" in the C standard sense of the term.
>>
>> It is not a function in the C sense - "sizeof x" is not like a
>> function call (where "x" is a variable or expression, rather than a
>> type). However, many people (myself included) feel it is clearer in
>> code to write it as "sizeof(x)", making it look more like a function
>> or function-like macro.
>
> And many people (myself included) feel it is clearer to write it as
> `sizeof x`, precisely so it *doesn't* look like a function call, because
> it isn't one. Similarly, I don't use unnecessary parentheses on return
> statements.
>
> I also write `sizeof (int)` rather than `sizeof(int)`. The parentheses
> look similar to those in a function call, but the construct is
> semantically distinct. I think of keywords as a different kind of
> token than identifiers, even though they look similar (and the standard
> describes them that way).
>

Fair enough. I think a lot of this kind of thing is just habit or
personal preference. There's always little differences in the way
people write their code.

>> I suspect the prime reason "sizeof" is a word, rather than a symbol or
>> sequence of symbols, is that the word is very clear while there are no
>> suitable choices of symbols for the task. The nearest might have been
>> "#", but that might have made pre-processor implementations more
>> difficult. Of course any symbol or combination /could/ have been
>> used, and people would have learned its meaning, but "sizeof" just
>> seems so much simpler.
>
> It has occurred to me that if there had been a strong desire to use a
> symbol, "$" could have worked. It even suggests the 's' in the word
> "size".
>
> But there was no such desire. sizeof happens to be the only operator
> whose symbol is a keyword, but I see no particular significance to this,
> and no reason not to define it that way. I might even have preferred
> keywords for some of C's well-populated zoo of operators. See also
> Pascal, which has keywords "and", "or", "not", and "mod".
>

Agreed. I don't think these details really make a big difference to
programming languages.

Re: iso646.h

<up0qad$2v1n8$1@dont-email.me>

  copy mid

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

  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: Fri, 26 Jan 2024 18:31:57 +0100
Organization: A noiseless patient Spider
Lines: 117
Message-ID: <up0qad$2v1n8$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>
<uor4rf$1r10t$1@dont-email.me> <87frym7l3p.fsf@nosuchdomain.example.com>
<uot08a$278i2$1@dont-email.me> <uotmed$2ack6$2@dont-email.me>
<uoto3n$2an28$1@dont-email.me> <uou05d$2bvjr$2@dont-email.me>
<uou170$2c7ed$1@dont-email.me> <uouf96$2em2l$2@dont-email.me>
<uov1f5$2heei$1@dont-email.me> <up0l1l$2u6hl$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 26 Jan 2024 17:31:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="34d0e4a1519ed875e1dea122a8a9c63a";
logging-data="3114728"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Ob6+2a5l6vVD5pW6bNsBE"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:LLFHqMOgbiv+MGgetickGEsAlgk=
In-Reply-To: <up0l1l$2u6hl$1@dont-email.me>
 by: Janis Papanagnou - Fri, 26 Jan 2024 17:31 UTC

All what you wrote below targets at your last sentense
"those side-effects could be executed in any order".
For the examples we had, like (informally) cout<<a<<b<<c;
this is undisputed for the SIDE EFFECTS of "a", etc. You
had "hidden" those side effects in "one()", I gave in an
earlier post the more obvious example c++ in the context
of cout << c++ << c++ << c++ << endl; as side effects.
All side effects can be a problem (and should be avoided
unless "necessary"). My point was that the order of '<<'
with its arguments is NOT corrupted. I interpreted your
previous posting that you'd have heard that to be an issue.
If you haven't meant to say that there's nothing more to
say about the issue, since the other things you filled your
post with is only distracting from the point in question.

Janis

On 26.01.2024 17:01, David Brown wrote:
> On 26/01/2024 02:21, Janis Papanagnou wrote:
>> On 25.01.2024 21:11, David Brown wrote:
>>> On 25/01/2024 17:11, Janis Papanagnou wrote:
>
>>>> Is or was there any compiler that implemented that in the "unexpected"
>>>> order?
>>>>
>>>
>>> There were indeed such real-world cases, complaints were made,
>>
>> Complaints that the rule was not clear in its definition?
>> Or complaints that their compiler did not support cout<<a<<b<<c;
>> correctly? - I would be astonished about the latter.
>
> The pre-C++17 rule was perfectly clear - there was no specified order of
> execution for the operands. (And I thought I'd made /that/ perfectly
> clear already.) Compilers all worked correctly - they can hardly have
> fallen foul of a rule that did not exist.
>
> The complaints (at least, the ones based on facts rather than
> misunderstandings) were about the lack of a rule that enforced
> evaluation order in certain cases.
>
> So C++17 added rules for evaluation orders in some circumstances, but
> not others. In C++17, but not before (and not in C), the evaluation of
> the expression "one" (and any side-effects) must come before the
> evaluation of "two" for, amongst other things :
>
> one << two
> one >> two
> one[two]
> two = one
>
> There is still /no/ ordering for
>
> one * two
> one + two
>
> and many other cases.
>
> And of course there are cases where there has always been a sequence
> point, and therefore an order of evaluation (a logical order, that is -
> if the compiler can see it makes no difference to the observable
> effects, it can always re-arrange anything).
>
> <https://en.cppreference.com/w/cpp/language/eval_order>
> <https://en.cppreference.com/w/c/language/eval_order>
>
>
>> This is so fundamental a construct and so frequently used that any
>> compiler would have been withdrawn in the week after it came out.
>> That is my expectation. So I would be grateful if you could provide
>> some evidence that I can look up.
>
> <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0145r3.pdf>
>
> For an example in practice, where you can see the generated assembly:
>
> <https://www.godbolt.org/z/fWezzx1nd>
>
> If I remember correctly, gcc 7 implemented the ordering rules from C++17
> and back-ported them to previous C++ standards for user convenience (as
> the order was previously unspecified, it was fine to do that).
>
> Look at the generated assembly and the order in which the calls to
> one(), two(), three() and four() are made. For the operator "<<", they
> are made in order one() to four(). For the operator "+", and for
> function call parameters, they are generated in order four() to one()
> for this case. (In other cases, that may be different - that's what
> "unspecified" means.)
>
>>
>> Mind that even if two() is evaluated before one(), it will not be
>> output before the stream of the first expression op<<(cout, one())
>> is available, and for this one() must be evaluated. Then one() can
>> be sent to the stream, and then also two() can be sent to the stream.
>> (Am I missing something?)
>
> The output to the stream must be in the order given in the code - that
> is true. But the values to be output could (prior to C++17) be
> evaluated in any order. If one() and two() have side-effects, that is
> critical - those side-effects could be executed in any order.
>
>>
>> Janis
>>
>>> and the rules changed in C++17.
>>>
>>> Usually it doesn't matter what order arguments to functions (or operands
>>> to operators) are evaluated. Some compilers have consistent ordering
>>> (and it is often last to first, not first to last), others pick whatever
>>> makes sense at the time. The ordering has been explicitly and clearly
>>> stated as "unspecified" since around the beginning of time (which was,
>>> as we all know, 01.01.1970).
>>
>>
>

Re: iso646.h

<up0rth$2vbj2$1@dont-email.me>

  copy mid

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

  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: Fri, 26 Jan 2024 18:59:02 +0100
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <up0rth$2vbj2$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>
<uor4rf$1r10t$1@dont-email.me> <uorolm$1uaut$1@dont-email.me>
<uotnnt$2akq3$1@dont-email.me> <uou1lg$2c9us$1@dont-email.me>
<875xzh43us.fsf@nosuchdomain.example.com> <up07tb$2qm2c$1@dont-email.me>
<up0lab$2u6hl$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 26 Jan 2024 17:59:13 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="34d0e4a1519ed875e1dea122a8a9c63a";
logging-data="3124834"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ZymEFk9bjoRclo1kTU0VC"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:tYeKSHyemYNyN9LiRMBcFEB5BmQ=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <up0lab$2u6hl$2@dont-email.me>
 by: Janis Papanagnou - Fri, 26 Jan 2024 17:59 UTC

On 26.01.2024 17:06, David Brown wrote:
> On 26/01/2024 13:17, Malcolm McLean wrote:
>
>> We could say that in comp.lang.c "function" shall mean "a subroutine"
>
> Why don't we just say - as everyone in this group except you already
> says, that in c.l.c. "function" means "C function" as described in the C
> standards, and any other type of function needs to be qualified?
>
> Thus "the tan function" here means the function from <math.h>, not the
> mathematical function, or something done when making leather.
>
> It really is not difficult.

Unless the discussion was done on a meta-level as opposed to a
concrete language specific implementation-model of a function,
or a concrete functions. - My impression from the posts upthread
was that we were taking on the meta-level to understand what we
actually have (with tha 'sizeof' beast) or how to consider it
conceptionally.

I also think that this is the key to not talk past each other.

The term "function" in computer science seems to have never been
an issue of dispute - I mean on a terminology level; explanations
in lectures or books were quite coherent, and since there was no
dispute everyone seems to have understood what a function is; in
computer science and in mathematics.

From my references it seems a consensus at least in that it's
reflecting a mathematical f: (x,y,...) -> (u,v,...) which is
projected at (or implemented by) some routine/procedure/method/
function, etc. - however it's called in any programming language.

The terminology certainly differs, but the interpretation less.

If we look deeper at the issue we can of course make academic
battles about other "function concepts" (my favorite example
is analogue computers; but that's extreme, of course). But in
that narrow corner we're discussing things it's sufficient IMO,
and probably more rewarding than restricting on the C function
implementation model.

How should we get principle insights on 'sizeof', what it is,
what it should be, etc., if we stay within this restricted C
world terminology, and discussing even a very special type of
a, umm.., function (sort of).

Janis

Re: iso646.h

<up0vec$2vv0k$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!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: Fri, 26 Jan 2024 19:59:23 +0100
Organization: A noiseless patient Spider
Lines: 156
Message-ID: <up0vec$2vv0k$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>
<uor4rf$1r10t$1@dont-email.me> <87frym7l3p.fsf@nosuchdomain.example.com>
<uot08a$278i2$1@dont-email.me> <uotmed$2ack6$2@dont-email.me>
<uoto3n$2an28$1@dont-email.me> <uou05d$2bvjr$2@dont-email.me>
<uou170$2c7ed$1@dont-email.me> <uouf96$2em2l$2@dont-email.me>
<uov1f5$2heei$1@dont-email.me> <up0l1l$2u6hl$1@dont-email.me>
<up0qad$2v1n8$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 26 Jan 2024 18:59:24 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5275502989ed94a21b07f0e0ca598467";
logging-data="3144724"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19+amTdzjwk0K8DFgP6jV0aDkpsLfihPLY="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:iXde4hjVVdx1G/X7Sg+rxnXwE0s=
In-Reply-To: <up0qad$2v1n8$1@dont-email.me>
Content-Language: en-GB
 by: David Brown - Fri, 26 Jan 2024 18:59 UTC

On 26/01/2024 18:31, Janis Papanagnou wrote:
> All what you wrote below targets at your last sentense
> "those side-effects could be executed in any order".
> For the examples we had, like (informally) cout<<a<<b<<c;
> this is undisputed for the SIDE EFFECTS of "a", etc. You
> had "hidden" those side effects in "one()", I gave in an
> earlier post the more obvious example c++ in the context
> of cout << c++ << c++ << c++ << endl; as side effects.
> All side effects can be a problem (and should be avoided
> unless "necessary"). My point was that the order of '<<'
> with its arguments is NOT corrupted. I interpreted your
> previous posting that you'd have heard that to be an issue.
> If you haven't meant to say that there's nothing more to
> say about the issue, since the other things you filled your
> post with is only distracting from the point in question.
>

I said - repeatedly - that the order of evaluation of the operands to
most operators is unspecified in C and C++. This could result in
behaviour that was unexpected for some people, especially in connection
with cout and other C++ streams, and was thus specified in C++17 for
specific cases.

A typical example would be :

cout << "Start time: " << get_time() << "\n"
<< "Running tests... " << run_tests() << "\n"
<< "End time: " << get_time();

It was realistic - and indeed happened in some cases - for pre-C++17
compilers to generate the second "get_time()" call before "run_tests()",
and finally do the first "get_time()" call. Alternatively, the compiler
could call "get_time()" twice, with "run_tests()" called either before
or after that pair. In all these cases, the user will see an output
that was not at all what they intended, with time appearing to go
backwards or the test apparently taking no time.

This was the case regardless of whether or not "get_time()" and
"run_tests()" had any side-effects.

You are, quite obviously, guaranteed that in "cout << a << b << c", the
output was in order a, b, c. But that is a totally different matter
from the order of evaluation (and execution, for function calls) of the
subexpressions a, b, and c.

I have said exactly what I intended to say in this thread, but I suspect
you have mistaken what the term "order of evaluation" means, and
therefore misunderstood what I wrote. I hope this is all clear to you now.

>
>
> On 26.01.2024 17:01, David Brown wrote:
>> On 26/01/2024 02:21, Janis Papanagnou wrote:
>>> On 25.01.2024 21:11, David Brown wrote:
>>>> On 25/01/2024 17:11, Janis Papanagnou wrote:
>>
>>>>> Is or was there any compiler that implemented that in the "unexpected"
>>>>> order?
>>>>>
>>>>
>>>> There were indeed such real-world cases, complaints were made,
>>>
>>> Complaints that the rule was not clear in its definition?
>>> Or complaints that their compiler did not support cout<<a<<b<<c;
>>> correctly? - I would be astonished about the latter.
>>
>> The pre-C++17 rule was perfectly clear - there was no specified order of
>> execution for the operands. (And I thought I'd made /that/ perfectly
>> clear already.) Compilers all worked correctly - they can hardly have
>> fallen foul of a rule that did not exist.
>>
>> The complaints (at least, the ones based on facts rather than
>> misunderstandings) were about the lack of a rule that enforced
>> evaluation order in certain cases.
>>
>> So C++17 added rules for evaluation orders in some circumstances, but
>> not others. In C++17, but not before (and not in C), the evaluation of
>> the expression "one" (and any side-effects) must come before the
>> evaluation of "two" for, amongst other things :
>>
>> one << two
>> one >> two
>> one[two]
>> two = one
>>
>> There is still /no/ ordering for
>>
>> one * two
>> one + two
>>
>> and many other cases.
>>
>> And of course there are cases where there has always been a sequence
>> point, and therefore an order of evaluation (a logical order, that is -
>> if the compiler can see it makes no difference to the observable
>> effects, it can always re-arrange anything).
>>
>> <https://en.cppreference.com/w/cpp/language/eval_order>
>> <https://en.cppreference.com/w/c/language/eval_order>
>>
>>
>>> This is so fundamental a construct and so frequently used that any
>>> compiler would have been withdrawn in the week after it came out.
>>> That is my expectation. So I would be grateful if you could provide
>>> some evidence that I can look up.
>>
>> <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0145r3.pdf>
>>
>> For an example in practice, where you can see the generated assembly:
>>
>> <https://www.godbolt.org/z/fWezzx1nd>
>>
>> If I remember correctly, gcc 7 implemented the ordering rules from C++17
>> and back-ported them to previous C++ standards for user convenience (as
>> the order was previously unspecified, it was fine to do that).
>>
>> Look at the generated assembly and the order in which the calls to
>> one(), two(), three() and four() are made. For the operator "<<", they
>> are made in order one() to four(). For the operator "+", and for
>> function call parameters, they are generated in order four() to one()
>> for this case. (In other cases, that may be different - that's what
>> "unspecified" means.)
>>
>>>
>>> Mind that even if two() is evaluated before one(), it will not be
>>> output before the stream of the first expression op<<(cout, one())
>>> is available, and for this one() must be evaluated. Then one() can
>>> be sent to the stream, and then also two() can be sent to the stream.
>>> (Am I missing something?)
>>
>> The output to the stream must be in the order given in the code - that
>> is true. But the values to be output could (prior to C++17) be
>> evaluated in any order. If one() and two() have side-effects, that is
>> critical - those side-effects could be executed in any order.
>>
>>>
>>> Janis
>>>
>>>> and the rules changed in C++17.
>>>>
>>>> Usually it doesn't matter what order arguments to functions (or operands
>>>> to operators) are evaluated. Some compilers have consistent ordering
>>>> (and it is often last to first, not first to last), others pick whatever
>>>> makes sense at the time. The ordering has been explicitly and clearly
>>>> stated as "unspecified" since around the beginning of time (which was,
>>>> as we all know, 01.01.1970).
>>>
>>>
>>
>

Re: iso646.h

<up10ip$305rf$1@dont-email.me>

  copy mid

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

  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: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Fri, 26 Jan 2024 20:18:47 +0100
Organization: A noiseless patient Spider
Lines: 118
Message-ID: <up10ip$305rf$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>
<uor4rf$1r10t$1@dont-email.me> <uorolm$1uaut$1@dont-email.me>
<uotnnt$2akq3$1@dont-email.me> <uou1lg$2c9us$1@dont-email.me>
<875xzh43us.fsf@nosuchdomain.example.com> <up07tb$2qm2c$1@dont-email.me>
<up0lab$2u6hl$2@dont-email.me> <up0rth$2vbj2$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 26 Jan 2024 19:18:49 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="5275502989ed94a21b07f0e0ca598467";
logging-data="3151727"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+3Eii6GYtlV7Dvyrc7kGB4yz5Gsw6zRFA="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:dtEDJ4mgPR96X6FfsYfkO3QQDgk=
Content-Language: en-GB
In-Reply-To: <up0rth$2vbj2$1@dont-email.me>
 by: David Brown - Fri, 26 Jan 2024 19:18 UTC

On 26/01/2024 18:59, Janis Papanagnou wrote:
> On 26.01.2024 17:06, David Brown wrote:
>> On 26/01/2024 13:17, Malcolm McLean wrote:
>>
>>> We could say that in comp.lang.c "function" shall mean "a subroutine"
>>
>> Why don't we just say - as everyone in this group except you already
>> says, that in c.l.c. "function" means "C function" as described in the C
>> standards, and any other type of function needs to be qualified?
>>
>> Thus "the tan function" here means the function from <math.h>, not the
>> mathematical function, or something done when making leather.
>>
>> It really is not difficult.
>
> Unless the discussion was done on a meta-level as opposed to a
> concrete language specific implementation-model of a function,
> or a concrete functions. - My impression from the posts upthread
> was that we were taking on the meta-level to understand what we
> actually have (with tha 'sizeof' beast) or how to consider it
> conceptionally.

We are - probably futilely - trying to get Malcolm to understand that
even in "meta-level" discussions, it is vital to be clear what is meant
by terms. And "function" alone means "C function" in c.l.c. You might
often think it is obvious from the context whether someone means "C
functions", "mathematical functions", or "wedding functions", but with
Malcolm you /never/ know. It regularly means "Malcolm functions", which
have an approximate definition that might change at any time.

>
> I also think that this is the key to not talk past each other.
>
> The term "function" in computer science seems to have never been
> an issue of dispute - I mean on a terminology level; explanations
> in lectures or books were quite coherent, and since there was no
> dispute everyone seems to have understood what a function is; in
> computer science and in mathematics.

The term "function" is most certainly in dispute in computer science.
It means different things - sometimes subtly, sometimes significantly -
in the context of different programming languages, or computation
theory, or mathematics. A "C function" is different from a "Pascal
function", a "lambda calculus function", a "Turing machine function", or
any other kind of function definition you want to pick.

>
> From my references it seems a consensus at least in that it's
> reflecting a mathematical f: (x,y,...) -> (u,v,...) which is
> projected at (or implemented by) some routine/procedure/method/
> function, etc. - however it's called in any programming language.

No, that is only one kind of function. There are all sorts of questions
to ask.

Can functions have side effects?

Do functions have to have outputs? Do they have to have inputs?

Does a function have to give the same output for the same inputs?

Can a function give more than one output? Does a function actually have
to be executed as called, or can the language re-arrange things?

Is it valid to have a function that does not satisfy certain
requirements, if that function is never called?

Can functions operate on types? Can they operate on other functions?
Can they operate on whole programs?

Does the function include some kind of data store? Does it include the
machine it executes on?

Does a function have to be executable? Does it even have to be
computable? Does it have to execute in a finite time?

Is a function a run-time entity, or a compile-time entity? Can it be
changed at run-time? Does it make sense to "run" a function at compile
time?

I'm sure we could go on.

>
> The terminology certainly differs, but the interpretation less.

The problem is that the terminology is the same, but the interpretation
can be wildly different. In order to communicate, we must be sure that
a given term is interpreted in the same way be each person.

>
> If we look deeper at the issue we can of course make academic
> battles about other "function concepts" (my favorite example
> is analogue computers; but that's extreme, of course). But in
> that narrow corner we're discussing things it's sufficient IMO,
> and probably more rewarding than restricting on the C function
> implementation model.

I think we're fine sticking to "function" meaning "C function", which is
well defined by the C standards, and using "mathematical function" for
mathematical functions, which are also quite solidly defined. Any other
usage will need to be explained at the time.

>
> How should we get principle insights on 'sizeof', what it is,
> what it should be, etc., if we stay within this restricted C
> world terminology, and discussing even a very special type of
> a, umm.., function (sort of).
>

Sizeof is not a C function. It is a C operator. If you don't know what
it is or how it works, or want the technical details, it's all in
6.5.3.4 of the C standards.

Trying to describe "sizeof" as a function of some sort with a different
kind of use of the word "function" really doesn't get us anywhere, as
shown in this thread. It is what it is - trying to mush it into another
term is not helpful.

Re: iso646.h

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

  copy mid

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

  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....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: iso646.h
Date: Fri, 26 Jan 2024 12:27:24 -0800
Organization: None to speak of
Lines: 82
Message-ID: <87cytn3knn.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> <uoqvas$1q40p$1@dont-email.me>
<uor4rf$1r10t$1@dont-email.me>
<87frym7l3p.fsf@nosuchdomain.example.com>
<uot08a$278i2$1@dont-email.me> <uotmed$2ack6$2@dont-email.me>
<uoto3n$2an28$1@dont-email.me> <uou05d$2bvjr$2@dont-email.me>
<uou170$2c7ed$1@dont-email.me> <uouf96$2em2l$2@dont-email.me>
<uov1f5$2heei$1@dont-email.me> <up0l1l$2u6hl$1@dont-email.me>
<up0qad$2v1n8$1@dont-email.me> <up0vec$2vv0k$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="8f39831f746400b49513f5e46ff4c868";
logging-data="3172995"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+yGi2FAthUfqiukWRvfBlw"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:zvzHIFEAcpbHpI13CmIgrhabTN8=
sha1:xL7LYU7NgN1ExWSzA73AZLiWhvg=
 by: Keith Thompson - Fri, 26 Jan 2024 20:27 UTC

David Brown <david.brown@hesbynett.no> writes:
[...]
> You are, quite obviously, guaranteed that in "cout << a << b << c",
> the output was in order a, b, c. But that is a totally different
> matter from the order of evaluation (and execution, for function
> calls) of the subexpressions a, b, and c.
[...]

Perhaps I can help clarify this a bit (or perhaps muddy the waters
even further). I'll try to add a bit of C relevance at the bottom.

In `cout << a << b << c`, if a, b, and c are names of non-volatile
objects, the evaluation order doesn't matter. The values of a, b,
and c will be written to the standard output stream in that order,
in all versions of C++.

In `cout << x() << y() << z()`, it's also guaranteed that the
result of the call to `x()` will precede the result of the call to
`y()`, which will precede the result of the call to `z()`, in the
text written to the output stream. What's not guaranteed prior
to C++17 is the order in which the three functions will be called.
If none of the functions have side effects that affect the results
of the other two, or depend on non-local data, it doesn't matter.
If the functions return, say, a string representation of the current
time with nanosecond resolution, the three results can be in any
of 6 orders prior to C++17; in C++17 and later, the timestamps will
always be in increasing order.

C++ overloads the "<<" shift operator for output operations, so each
"<<" after `std::cout` is really a function call, but the rules for
sequencing and order of evaluation are the same as for the built-in
"<<" integer shift operation. C++ could have imposed sequencing
requirements only on overloaded "<<" and ">> operators, but that
would have been more difficult to specify in the standard.

C++17 added a new requirement that the evaluation of the left
operand of "<<" or ">>" is "sequenced before" the right operand,
meaning that any side effects of the evaluation of the left operand
must be complete before evaluation of the right operand begins
(though optimizations that don't change the visible behavior are
still allowed). It did not add such a requirement for the "+"
operator, which is overloaded for std::string concatenation.

Here's an example:

#include <iostream>
#include <string>

static std::string func() {
static std::string results[] = {
"zero", "one", "two", "three", "four"
};
static int index = 0;
return results[index++];
}

int main() {
std::cout << func() << ' ' << func() << '\n';
std::string s = func() + ' ' + func() + '\n';
std::cout << s;
}

Prior to C++17, the first line of output could be either "zero one"
or "one zero", and the second could be either "two three" or
"three two". In C++17 and later, the first line of output must
be "zero one", but the second can still be either "two three" or
"three two" (I get different results with g++ and clang++).

(This raises some interesting questions about C++ I/O manipulators,
but I won't get into that here.)

The relevance to C is that a future C standard *could* impose new
sequencing requirements for some or all operators and for function
arguments, but without C++-style operator overloading there are
fewer contexts in which it would matter. If the operands of "+"
were sequenced, then `i++ + i++` would have defined behavior (it's
currently undefined).

--
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 */


devel / comp.lang.c / iso646.h

Pages:1234567891011121314151617181920212223242526
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor