Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

I haven't lost my mind -- it's backed up on tape somewhere.


devel / comp.lang.c++ / Re: What does this code print ?

SubjectAuthor
* What does this code print ?Bonita Montero
`* Re: What does this code print ?Ben Bacarisse
 +* Re: What does this code print ?Kenny McCormack
 |`* Re: What does this code print ?Bonita Montero
 | +* Re: What does this code print ?Scott Lurndal
 | |+- Re: What does this code print ?Bo Persson
 | |`* Re: What does this code print ?Bonita Montero
 | | `* Re: What does this code print ?Ben Bacarisse
 | |  `- Re: What does this code print ?Bonita Montero
 | `* Re: What does this code print ?Richard Damon
 |  +- Re: What does this code print ?Scott Lurndal
 |  `* Re: What does this code print ?Bonita Montero
 |   `* Re: What does this code print ?Richard Damon
 |    `* Re: What does this code print ?Bonita Montero
 |     +- Re: What does this code print ?Chris M. Thomasson
 |     `* Re: What does this code print ?Richard Damon
 |      `- Re: What does this code print ?Chris M. Thomasson
 +- Re: What does this code print ?Bonita Montero
 +* Re: What does this code print ?Chris M. Thomasson
 |+- Re: What does this code print ?Chris M. Thomasson
 |`- Re: What does this code print ?Bonita Montero
 `* Re: What does this code print ?Chris M. Thomasson
  `* Re: What does this code print ?Bonita Montero
   +* Re: What does this code print ?Richard Damon
   |`* Re: What does this code print ?Bonita Montero
   | `* Re: What does this code print ?Richard Damon
   |  `* Re: What does this code print ?Bonita Montero
   |   `* Re: What does this code print ?Richard Damon
   |    `* Re: What does this code print ?Bonita Montero
   |     `- Re: What does this code print ?Chris M. Thomasson
   +* Re: What does this code print ?Kaz Kylheku
   |+* Re: What does this code print ?Chris M. Thomasson
   ||`* Re: What does this code print ?Kaz Kylheku
   || +- Re: What does this code print ?Chris M. Thomasson
   || `* Re: What does this code print ?Paavo Helde
   ||  `* Re: What does this code print ?Chris M. Thomasson
   ||   `* Re: What does this code print ?Kaz Kylheku
   ||    `* Re: What does this code print ?Paavo Helde
   ||     `* Re: What does this code print ?Kaz Kylheku
   ||      `* Re: What does this code print ?Chris M. Thomasson
   ||       `- Re: What does this code print ?Chris M. Thomasson
   |`* Re: What does this code print ?Bonita Montero
   | `* Re: What does this code print ?Kaz Kylheku
   |  +- Re: What does this code print ?Richard Damon
   |  `- Re: What does this code print ?Bonita Montero
   +* Re: What does this code print ?Richard Damon
   |`* Re: What does this code print ?Bonita Montero
   | +* Re: What does this code print ?Bonita Montero
   | |+* Re: What does this code print ?Bonita Montero
   | ||`* Re: What does this code print ?Richard Damon
   | || `* Re: What does this code print ?Bonita Montero
   | ||  `* Re: What does this code print ?Richard Damon
   | ||   +* Re: What does this code print ?Bonita Montero
   | ||   |`- Re: What does this code print ?Richard Damon
   | ||   `* Re: What does this code print ?Bonita Montero
   | ||    `* Re: What does this code print ?Kaz Kylheku
   | ||     `* Re: What does this code print ?Bonita Montero
   | ||      `* Re: What does this code print ?Kaz Kylheku
   | ||       +- Re: What does this code print ?Richard Damon
   | ||       `* Re: What does this code print ?Chris M. Thomasson
   | ||        `* Re: What does this code print ?Kaz Kylheku
   | ||         `* Re: What does this code print ?Bonita Montero
   | ||          +* Re: What does this code print ?Richard Damon
   | ||          |`* Re: What does this code print ?Bonita Montero
   | ||          | `* Re: What does this code print ?Richard Damon
   | ||          |  `* Re: What does this code print ?Bonita Montero
   | ||          |   `* Re: What does this code print ?Richard Damon
   | ||          |    `* Re: What does this code print ?Bonita Montero
   | ||          |     `* Re: What does this code print ?Richard Damon
   | ||          |      `* Re: What does this code print ?Bonita Montero
   | ||          |       `* Re: What does this code print ?Richard Damon
   | ||          |        `* Re: What does this code print ?Bonita Montero
   | ||          |         `* Re: What does this code print ?Richard Damon
   | ||          |          `* Re: What does this code print ?Bonita Montero
   | ||          |           +- Re: What does this code print ?Branimir Maksimovic
   | ||          |           `* Re: What does this code print ?Richard Damon
   | ||          |            `* Re: What does this code print ?Bonita Montero
   | ||          |             `* Re: What does this code print ?Richard Damon
   | ||          |              `* Re: What does this code print ?Bonita Montero
   | ||          |               +* Re: What does this code print ?Richard Damon
   | ||          |               |+* Re: What does this code print ?Bonita Montero
   | ||          |               ||+* Re: What does this code print ?Richard Damon
   | ||          |               |||`* Re: What does this code print ?Bonita Montero
   | ||          |               ||| `* Re: What does this code print ?Richard Damon
   | ||          |               |||  `* Re: What does this code print ?Bonita Montero
   | ||          |               |||   `* Re: What does this code print ?Richard Damon
   | ||          |               |||    `* Re: What does this code print ?Bonita Montero
   | ||          |               |||     `* Re: What does this code print ?Kaz Kylheku
   | ||          |               |||      `* Re: What does this code print ?Bonita Montero
   | ||          |               |||       `* Re: What does this code print ?Richard Damon
   | ||          |               |||        `- Re: What does this code print ?Bonita Montero
   | ||          |               ||`* Re: What does this code print ?Branimir Maksimovic
   | ||          |               || `- Re: What does this code print ?Bonita Montero
   | ||          |               |`* Re: What does this code print ?Scott Lurndal
   | ||          |               | `- Re: What does this code print ?Richard Damon
   | ||          |               `* Re: What does this code print ?Kaz Kylheku
   | ||          |                `- Re: What does this code print ?Bonita Montero
   | ||          `* Re: What does this code print ?Kaz Kylheku
   | ||           +* Re: What does this code print ?Bo Persson
   | ||           |`- Re: What does this code print ?Kaz Kylheku
   | ||           `* Re: What does this code print ?Bonita Montero
   | |`* Re: What does this code print ?Richard Damon
   | +* Re: What does this code print ?Scott Lurndal
   | `- Re: What does this code print ?Richard Damon
   `* Re: What does this code print ?Chris M. Thomasson

Pages:123456
Re: What does this code print ?

<ugl77t$2pe6u$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Tue, 17 Oct 2023 07:48:45 +0200
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <ugl77t$2pe6u$2@dont-email.me>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<ugg3c2$ckp0$1@dont-email.me> <ugg3l3$cmg4$1@dont-email.me>
<ugh7s8$1k9qh$3@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 17 Oct 2023 05:48:45 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="58032372cf3bef9fbab18d712d3e9ed9";
logging-data="2930910"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/OYY0NVWoqDEZcJuogZhWAT0P3lBgu1vo="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:flaRXLqU89zT4+TsGyz/cnzajD8=
Content-Language: de-DE
In-Reply-To: <ugh7s8$1k9qh$3@i2pn2.org>
 by: Bonita Montero - Tue, 17 Oct 2023 05:48 UTC

Am 15.10.2023 um 19:35 schrieb Richard Damon:
> On 10/15/23 3:16 AM, Bonita Montero wrote:
>> Am 15.10.2023 um 09:12 schrieb Bonita Montero:
>>> Am 15.10.2023 um 09:07 schrieb Bonita Montero:
>>>
>>>> The compiler can't ignore the calling convention since the definition
>>>> of the variable and the assignment might be spareate. I just printed
>>>> both pointer's addresses and I get different addresses. So there are
>>>> only two options left: either there are separate instantiations for
>>>> each calling convention or there's additional thunk code for each
>>>> calling convention that doesn't mach the standard calling convention.
>>>
>>> This are both instantiations copied from the disassembly in the
>>> debugger:
>>>
>>> 005F10D0 64 A1 2C 00 00 00    mov         eax,dword ptr fs:[0000002Ch]
>>> 005F10D6 56                   push        esi
>>> 005F10D7 8B 30                mov         esi,dword ptr [eax]
>>> 005F10D9 8B 96 04 00 00 00    mov         edx,dword ptr [esi+4]
>>> 005F10DF 8D 42 01             lea         eax,[edx+1]
>>> 005F10E2 89 86 04 00 00 00    mov         dword ptr [esi+4],eax
>>> 005F10E8 8D 04 0A             lea         eax,[edx+ecx]
>>> 005F10EB 5E                   pop         esi
>>> 005F10EC C3                   ret
>>>
>>> 005F10A0 55                   push        ebp
>>> 005F10A1 8B EC                mov         ebp,esp
>>> 005F10A3 64 A1 2C 00 00 00    mov         eax,dword ptr fs:[0000002Ch]
>>> 005F10A9 8B 08                mov         ecx,dword ptr [eax]
>>> 005F10AB 8B 91 04 00 00 00    mov         edx,dword ptr [ecx+4]
>>> 005F10B1 8D 42 01             lea         eax,[edx+1]
>>> 005F10B4 89 81 04 00 00 00    mov         dword ptr [ecx+4],eax
>>> 005F10BA 8B 45 08             mov         eax,dword ptr [a]
>>> 005F10BD 03 C2                add         eax,edx
>>> 005F10BF 5D                   pop         ebp
>>> 005F10C0 C2 04 00             ret         4
>>
>> The symbols for both functions are ...
>>
>> * `main'::`2'::<lambda_1>::<lambda_invoker_fastcall>
>> * `main'::`2'::<lambda_1>::<lambda_invoker_stdcall>
>>
>
> So, two wrappers for the same function. ...

If there were wrappers there would be a CALL XXX.

Re: What does this code print ?

<ugl7b1$2pe6u$3@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Tue, 17 Oct 2023 07:50:25 +0200
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <ugl7b1$2pe6u$3@dont-email.me>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<ugg3c2$ckp0$1@dont-email.me> <ugh7se$1k9qh$4@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 17 Oct 2023 05:50:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="58032372cf3bef9fbab18d712d3e9ed9";
logging-data="2930910"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/CXTrjM1CQ6ohaP+zPvfFfwyhgFzrX78g="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:xDJyVzLHRXslfSt2Z2G+hzL2L/g=
Content-Language: de-DE
In-Reply-To: <ugh7se$1k9qh$4@i2pn2.org>
 by: Bonita Montero - Tue, 17 Oct 2023 05:50 UTC

Am 15.10.2023 um 19:35 schrieb Richard Damon:
> On 10/15/23 3:12 AM, Bonita Montero wrote:
>> Am 15.10.2023 um 09:07 schrieb Bonita Montero:
>>
>>> The compiler can't ignore the calling convention since the definition
>>> of the variable and the assignment might be spareate. I just printed
>>> both pointer's addresses and I get different addresses. So there are
>>> only two options left: either there are separate instantiations for
>>> each calling convention or there's additional thunk code for each
>>> calling convention that doesn't mach the standard calling convention.
>>
>> This are both instantiations copied from the disassembly in the
>> debugger:
>>
>> 005F10D0 64 A1 2C 00 00 00    mov         eax,dword ptr fs:[0000002Ch]
>> 005F10D6 56                   push        esi
>> 005F10D7 8B 30                mov         esi,dword ptr [eax]
>> 005F10D9 8B 96 04 00 00 00    mov         edx,dword ptr [esi+4]
>> 005F10DF 8D 42 01             lea         eax,[edx+1]
>> 005F10E2 89 86 04 00 00 00    mov         dword ptr [esi+4],eax
>> 005F10E8 8D 04 0A             lea         eax,[edx+ecx]
>> 005F10EB 5E                   pop         esi
>> 005F10EC C3                   ret
>>
>> 005F10A0 55                   push        ebp
>> 005F10A1 8B EC                mov         ebp,esp
>> 005F10A3 64 A1 2C 00 00 00    mov         eax,dword ptr fs:[0000002Ch]
>> 005F10A9 8B 08                mov         ecx,dword ptr [eax]
>> 005F10AB 8B 91 04 00 00 00    mov         edx,dword ptr [ecx+4]
>> 005F10B1 8D 42 01             lea         eax,[edx+1]
>> 005F10B4 89 81 04 00 00 00    mov         dword ptr [ecx+4],eax
>> 005F10BA 8B 45 08             mov         eax,dword ptr [a]
>> 005F10BD 03 C2                add         eax,edx
>> 005F10BF 5D                   pop         ebp
>> 005F10C0 C2 04 00             ret         4
>>
>>
>
> Which is also consistant with a single definition that was inline
> expanded at the two assignment sites

You can see from the RET (xxx) that these are separate functions.
And the functions couldn't be inlined because I hide them behind
volatile function ponters.

> Thus it isn't that you got "two different lambda" with different calling
> convention refencing the same variable, but you have ONE lambda, ...

Seems you're not able to read assembly.

Re: What does this code print ?

<ugl7c6$2pe6u$4@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Tue, 17 Oct 2023 07:51:02 +0200
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <ugl7c6$2pe6u$4@dont-email.me>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<5OSWM.54624$tnmf.54137@fx09.iad> <ugh375$jdrk$1@dont-email.me>
<ugi6q6$ulpp$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 17 Oct 2023 05:51:02 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="58032372cf3bef9fbab18d712d3e9ed9";
logging-data="2930910"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18W3FrzkdNHWDum5HbPw/dJlVMzZohmmVc="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:YlaZXjvN1YTyQFVecILbUyFcuVc=
In-Reply-To: <ugi6q6$ulpp$2@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Tue, 17 Oct 2023 05:51 UTC

Am 16.10.2023 um 04:23 schrieb Richard Damon:
> On 10/15/23 12:15 PM, Bonita Montero wrote:
>> Am 15.10.2023 um 16:36 schrieb Scott Lurndal:
>>
>>> So, you cannot point to any words in the standard.  Noted.
>>
>> If you don't like platform-specific objections don't read them.
>>
>>
> If making platform-specific question, mention the platform, or better,
> post it in the platform specific group.

As I said you're a nerd.

> Platform specific code, when not restricted to the platform, is often
> undefined in the more general world.

Re: What does this code print ?

<ugmk4c$347g6$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!news.hispagatos.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Tue, 17 Oct 2023 11:34:53 -0700
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <ugmk4c$347g6$1@dont-email.me>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugbqf7$19fre$3@i2pn2.org> <uge6gg$3spt4$3@dont-email.me>
<ugebv8$1gabn$2@i2pn2.org> <ugg2li$cf8s$2@dont-email.me>
<ugh6nc$1k9qg$1@i2pn2.org> <ugl76a$2pe6u$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 17 Oct 2023 18:34:52 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="96e75d755941e0def836c1472cd69b5c";
logging-data="3284486"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/wrlK/mrHe8MfEOnYEIzRbkNhnFeEcwzo="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:2VdOGcpxBu1n2EawDURydarrdKg=
In-Reply-To: <ugl76a$2pe6u$1@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Tue, 17 Oct 2023 18:34 UTC

On 10/16/2023 10:47 PM, Bonita Montero wrote:
> Am 15.10.2023 um 19:15 schrieb Richard Damon:
>
>> What make you say that?
>
> I know nerds.
>
> Rest unread.
>

You are a special person, Bonita! :^)

Re: What does this code print ?

<ugmk55$347g6$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!news.chmurka.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Tue, 17 Oct 2023 11:35:18 -0700
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <ugmk55$347g6$2@dont-email.me>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<20231013081459.652@kylheku.com> <ugc8bo$3cv2m$1@dont-email.me>
<20231013192405.57@kylheku.com> <ugdkql$3p94s$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 17 Oct 2023 18:35:18 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="96e75d755941e0def836c1472cd69b5c";
logging-data="3284486"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19H9t4pZmMv+4Odv47WAv9Ebm3JneT4DhE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:/GjxGBphh7Liv/CmJOsPFI9wEvw=
Content-Language: en-US
In-Reply-To: <ugdkql$3p94s$1@dont-email.me>
 by: Chris M. Thomasson - Tue, 17 Oct 2023 18:35 UTC

On 10/14/2023 1:51 AM, Paavo Helde wrote:
> 14.10.2023 05:36 Kaz Kylheku kirjutas:
>>
>> The thread-specific keys values of a thread should persist until it
>> has terminated, and then be cleaned up at some later time by
>> *another* thread. Kind of like a garbage collection pass.
>
> So, a destructor of an object which has specifically declared to live in
> a single thread only, will be called in some other thread?
>
> Sure, seems very intuitive, what might go wrong!

Ditto.

Re: What does this code print ?

<20231017125440.439@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Tue, 17 Oct 2023 20:06:23 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <20231017125440.439@kylheku.com>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<20231013081459.652@kylheku.com> <ugc8bo$3cv2m$1@dont-email.me>
<20231013192405.57@kylheku.com> <ugdkql$3p94s$1@dont-email.me>
<ugmk55$347g6$2@dont-email.me>
Injection-Date: Tue, 17 Oct 2023 20:06:23 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="fc96faa360b08b4b883bddb5cec8312d";
logging-data="3321405"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+hi2Qd1XgJfcyH2boAaD/YY8eJtdsigQ8="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:BJS7+14xpNmC/SzyYfVbFua3ZXU=
 by: Kaz Kylheku - Tue, 17 Oct 2023 20:06 UTC

On 2023-10-17, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
> On 10/14/2023 1:51 AM, Paavo Helde wrote:
>> 14.10.2023 05:36 Kaz Kylheku kirjutas:
>>>
>>> The thread-specific keys values of a thread should persist until it
>>> has terminated, and then be cleaned up at some later time by
>>> *another* thread. Kind of like a garbage collection pass.
>>
>> So, a destructor of an object which has specifically declared to live in
>> a single thread only, will be called in some other thread?
>>
>> Sure, seems very intuitive, what might go wrong!
>
> Ditto.

Objects don't literally live in threads. Objects live in an address
space.

This is exactly like finalization of unreachable objects in managed
environments. If a thread holds some objects which are only accessible
to it, when that thraed terminates, they become garbage. They
necessarily get reclaimed by a different thread, and that one will
run their finalization hooks, if any.

If an object is used by only one thread during its lifetime, that means
that it doesn't require locking. However, the thread which reclaims the
object does not run at the same time as the thread which died, so there
is no race between the two. That aspect of it is fine.

The destructor cannot make the assumption that it is executed by that
same thread. E.g. if the object contained a stashed copy of the thread
ID of the original thread, the destructor would be wrong to assume that
the the thread which is executing it corresponds to that ID.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: What does this code print ?

<ugnhvc$1t8hq$1@i2pn2.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!.POSTED!not-for-mail
From: rich...@damon-family.org (Richard Damon)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Tue, 17 Oct 2023 23:04:12 -0400
Organization: i2pn2 (i2pn.org)
Message-ID: <ugnhvc$1t8hq$1@i2pn2.org>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<ugg3c2$ckp0$1@dont-email.me> <ugg3l3$cmg4$1@dont-email.me>
<ugh7s8$1k9qh$3@i2pn2.org> <ugl77t$2pe6u$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 18 Oct 2023 03:04:12 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="2007610"; mail-complaints-to="usenet@i2pn2.org";
posting-account="diqKR1lalukngNWEqoq9/uFtbkm5U+w3w6FQ0yesrXg";
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <ugl77t$2pe6u$2@dont-email.me>
 by: Richard Damon - Wed, 18 Oct 2023 03:04 UTC

On 10/17/23 1:48 AM, Bonita Montero wrote:
> Am 15.10.2023 um 19:35 schrieb Richard Damon:
>> On 10/15/23 3:16 AM, Bonita Montero wrote:
>>> Am 15.10.2023 um 09:12 schrieb Bonita Montero:
>>>> Am 15.10.2023 um 09:07 schrieb Bonita Montero:
>>>>
>>>>> The compiler can't ignore the calling convention since the definition
>>>>> of the variable and the assignment might be spareate. I just printed
>>>>> both pointer's addresses and I get different addresses. So there are
>>>>> only two options left: either there are separate instantiations for
>>>>> each calling convention or there's additional thunk code for each
>>>>> calling convention that doesn't mach the standard calling convention.
>>>>
>>>> This are both instantiations copied from the disassembly in the
>>>> debugger:
>>>>
>>>> 005F10D0 64 A1 2C 00 00 00    mov         eax,dword ptr fs:[0000002Ch]
>>>> 005F10D6 56                   push        esi
>>>> 005F10D7 8B 30                mov         esi,dword ptr [eax]
>>>> 005F10D9 8B 96 04 00 00 00    mov         edx,dword ptr [esi+4]
>>>> 005F10DF 8D 42 01             lea         eax,[edx+1]
>>>> 005F10E2 89 86 04 00 00 00    mov         dword ptr [esi+4],eax
>>>> 005F10E8 8D 04 0A             lea         eax,[edx+ecx]
>>>> 005F10EB 5E                   pop         esi
>>>> 005F10EC C3                   ret
>>>>
>>>> 005F10A0 55                   push        ebp
>>>> 005F10A1 8B EC                mov         ebp,esp
>>>> 005F10A3 64 A1 2C 00 00 00    mov         eax,dword ptr fs:[0000002Ch]
>>>> 005F10A9 8B 08                mov         ecx,dword ptr [eax]
>>>> 005F10AB 8B 91 04 00 00 00    mov         edx,dword ptr [ecx+4]
>>>> 005F10B1 8D 42 01             lea         eax,[edx+1]
>>>> 005F10B4 89 81 04 00 00 00    mov         dword ptr [ecx+4],eax
>>>> 005F10BA 8B 45 08             mov         eax,dword ptr [a]
>>>> 005F10BD 03 C2                add         eax,edx
>>>> 005F10BF 5D                   pop         ebp
>>>> 005F10C0 C2 04 00             ret         4
>>>
>>> The symbols for both functions are ...
>>>
>>> * `main'::`2'::<lambda_1>::<lambda_invoker_fastcall>
>>> * `main'::`2'::<lambda_1>::<lambda_invoker_stdcall>
>>>
>>
>> So, two wrappers for the same function. ...
>
> If there were wrappers there would be a CALL XXX.
>
>

Nope, because they are wrapping an inline function, which is expanded in
place the two times.

Note the name of the symbols, they are "invokers"

Re: What does this code print ?

<ugni73$1t8hq$2@i2pn2.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!.POSTED!not-for-mail
From: rich...@damon-family.org (Richard Damon)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Tue, 17 Oct 2023 23:08:19 -0400
Organization: i2pn2 (i2pn.org)
Message-ID: <ugni73$1t8hq$2@i2pn2.org>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<ugg3c2$ckp0$1@dont-email.me> <ugh7se$1k9qh$4@i2pn2.org>
<ugl7b1$2pe6u$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 18 Oct 2023 03:08:19 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="2007610"; mail-complaints-to="usenet@i2pn2.org";
posting-account="diqKR1lalukngNWEqoq9/uFtbkm5U+w3w6FQ0yesrXg";
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <ugl7b1$2pe6u$3@dont-email.me>
 by: Richard Damon - Wed, 18 Oct 2023 03:08 UTC

On 10/17/23 1:50 AM, Bonita Montero wrote:
> Am 15.10.2023 um 19:35 schrieb Richard Damon:
>> On 10/15/23 3:12 AM, Bonita Montero wrote:
>>> Am 15.10.2023 um 09:07 schrieb Bonita Montero:
>>>
>>>> The compiler can't ignore the calling convention since the definition
>>>> of the variable and the assignment might be spareate. I just printed
>>>> both pointer's addresses and I get different addresses. So there are
>>>> only two options left: either there are separate instantiations for
>>>> each calling convention or there's additional thunk code for each
>>>> calling convention that doesn't mach the standard calling convention.
>>>
>>> This are both instantiations copied from the disassembly in the
>>> debugger:
>>>
>>> 005F10D0 64 A1 2C 00 00 00    mov         eax,dword ptr fs:[0000002Ch]
>>> 005F10D6 56                   push        esi
>>> 005F10D7 8B 30                mov         esi,dword ptr [eax]
>>> 005F10D9 8B 96 04 00 00 00    mov         edx,dword ptr [esi+4]
>>> 005F10DF 8D 42 01             lea         eax,[edx+1]
>>> 005F10E2 89 86 04 00 00 00    mov         dword ptr [esi+4],eax
>>> 005F10E8 8D 04 0A             lea         eax,[edx+ecx]
>>> 005F10EB 5E                   pop         esi
>>> 005F10EC C3                   ret
>>>
>>> 005F10A0 55                   push        ebp
>>> 005F10A1 8B EC                mov         ebp,esp
>>> 005F10A3 64 A1 2C 00 00 00    mov         eax,dword ptr fs:[0000002Ch]
>>> 005F10A9 8B 08                mov         ecx,dword ptr [eax]
>>> 005F10AB 8B 91 04 00 00 00    mov         edx,dword ptr [ecx+4]
>>> 005F10B1 8D 42 01             lea         eax,[edx+1]
>>> 005F10B4 89 81 04 00 00 00    mov         dword ptr [ecx+4],eax
>>> 005F10BA 8B 45 08             mov         eax,dword ptr [a]
>>> 005F10BD 03 C2                add         eax,edx
>>> 005F10BF 5D                   pop         ebp
>>> 005F10C0 C2 04 00             ret         4
>>>
>>>
>>
>> Which is also consistant with a single definition that was inline
>> expanded at the two assignment sites
>
> You can see from the RET (xxx) that these are separate functions.
> And the functions couldn't be inlined because I hide them behind
> volatile function ponters.

Nope at the final CALL site, it needs to call through the pointer, but
the pointer needs to create the functions, which are wrappers around a
single function, which happens to be inlined for the two instances.

>
>> Thus it isn't that you got "two different lambda" with different
>> calling convention refencing the same variable, but you have ONE
>> lambda, ...
>
> Seems you're not able to read assembly.
>

No, I read it perfectly fine.

Do you not understand how inlining works?
Or how the compiler needs to generate the out of line copy of in line
functions?

The fact that they share a local scope 'static' variable says they must
be copies of the same inline function.

Re: What does this code print ?

<ugni7p$1t8hq$3@i2pn2.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!.POSTED!not-for-mail
From: rich...@damon-family.org (Richard Damon)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Tue, 17 Oct 2023 23:08:41 -0400
Organization: i2pn2 (i2pn.org)
Message-ID: <ugni7p$1t8hq$3@i2pn2.org>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<5OSWM.54624$tnmf.54137@fx09.iad> <ugh375$jdrk$1@dont-email.me>
<ugi6q6$ulpp$2@dont-email.me> <ugl7c6$2pe6u$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 18 Oct 2023 03:08:41 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="2007610"; mail-complaints-to="usenet@i2pn2.org";
posting-account="diqKR1lalukngNWEqoq9/uFtbkm5U+w3w6FQ0yesrXg";
User-Agent: Mozilla Thunderbird
In-Reply-To: <ugl7c6$2pe6u$4@dont-email.me>
Content-Language: en-US
 by: Richard Damon - Wed, 18 Oct 2023 03:08 UTC

On 10/17/23 1:51 AM, Bonita Montero wrote:
> Am 16.10.2023 um 04:23 schrieb Richard Damon:
>> On 10/15/23 12:15 PM, Bonita Montero wrote:
>>> Am 15.10.2023 um 16:36 schrieb Scott Lurndal:
>>>
>>>> So, you cannot point to any words in the standard.  Noted.
>>>
>>> If you don't like platform-specific objections don't read them.
>>>
>>>
>> If making platform-specific question, mention the platform, or better,
>> post it in the platform specific group.
>
> As I said you're a nerd.
>

And your an idiot troll.

>> Platform specific code, when not restricted to the platform, is often
>> undefined in the more general world.
>

Re: What does this code print ?

<ugo5ra$3i2k3$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: eesn...@osa.pri.ee (Paavo Helde)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Wed, 18 Oct 2023 11:43:20 +0300
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <ugo5ra$3i2k3$1@dont-email.me>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<20231013081459.652@kylheku.com> <ugc8bo$3cv2m$1@dont-email.me>
<20231013192405.57@kylheku.com> <ugdkql$3p94s$1@dont-email.me>
<ugmk55$347g6$2@dont-email.me> <20231017125440.439@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 18 Oct 2023 08:43:22 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8a9cf558346103eb4c0b7ef6944dde44";
logging-data="3738243"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18xzCCeH/ADXzG6w2FmFHqrfgcHER1Jkiw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:8mMNf7jsTYwpS3OpnF+LirQ8cWI=
Content-Language: en-US
In-Reply-To: <20231017125440.439@kylheku.com>
 by: Paavo Helde - Wed, 18 Oct 2023 08:43 UTC

17.10.2023 23:06 Kaz Kylheku kirjutas:
> On 2023-10-17, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
>> On 10/14/2023 1:51 AM, Paavo Helde wrote:
>>> 14.10.2023 05:36 Kaz Kylheku kirjutas:
>>>>
>>>> The thread-specific keys values of a thread should persist until it
>>>> has terminated, and then be cleaned up at some later time by
>>>> *another* thread. Kind of like a garbage collection pass.
>>>
>>> So, a destructor of an object which has specifically declared to live in
>>> a single thread only, will be called in some other thread?
>>>
>>> Sure, seems very intuitive, what might go wrong!
>>
>> Ditto.
>
> Objects don't literally live in threads. Objects live in an address
> space.
>
> This is exactly like finalization of unreachable objects in managed
> environments.

That's something we want to avoid, not to replicate.

> If a thread holds some objects which are only accessible
> to it, when that thraed terminates, they become garbage. They
> necessarily get reclaimed by a different thread, and that one will
> run their finalization hooks, if any.

We have been through that, here, long time ago, with a lot of pain and
suffering. The consensus reached was that if/when supporting something
like garbage collection in C++, only the occupied memory should be
released by GC. The destructors of objects should not be run, because
that would happen in a non-predictable thread at non-predictable time,
making the program non-deterministic.

To be honest, your idea to run the destructors during the thread join
makes it a bit more deterministic, so it is somewhat better.

Re: What does this code print ?

<20231018102525.515@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Wed, 18 Oct 2023 17:29:56 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <20231018102525.515@kylheku.com>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<20231013081459.652@kylheku.com> <ugc8bo$3cv2m$1@dont-email.me>
<20231013192405.57@kylheku.com> <ugdkql$3p94s$1@dont-email.me>
<ugmk55$347g6$2@dont-email.me> <20231017125440.439@kylheku.com>
<ugo5ra$3i2k3$1@dont-email.me>
Injection-Date: Wed, 18 Oct 2023 17:29:56 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="de5f358c4959603d92fcd6a3b00a4302";
logging-data="3969338"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19hsBe0OdvnOyR+W63dxSmVgvPsMgsWIMs="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:q6skwgM+vylB0rROCAOoRFLjp0k=
 by: Kaz Kylheku - Wed, 18 Oct 2023 17:29 UTC

On 2023-10-18, Paavo Helde <eesnimi@osa.pri.ee> wrote:
> We have been through that, here, long time ago, with a lot of pain and
> suffering. The consensus reached was that if/when supporting something
> like garbage collection in C++, only the occupied memory should be
> released by GC.

Well, this isn't that discussion; it's about a clean up of
thread-specfic keys when a thread dies.

No GC-like reachability analysis is required; the thread explicitly
terminated and so we know the key bindings are garbage, requiring
destruction. That is handed to us.

There are advantages to not doing that cleanup in the context of the
thread which died.

> The destructors of objects should not be run, because
> that would happen in a non-predictable thread at non-predictable time,
> making the program non-deterministic.

If you what deterministic, don't use these things called threads?

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: What does this code print ?

<ugp89p$3pur8$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Wed, 18 Oct 2023 11:31:21 -0700
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <ugp89p$3pur8$2@dont-email.me>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<20231013081459.652@kylheku.com> <ugc8bo$3cv2m$1@dont-email.me>
<20231013192405.57@kylheku.com> <ugdkql$3p94s$1@dont-email.me>
<ugmk55$347g6$2@dont-email.me> <20231017125440.439@kylheku.com>
<ugo5ra$3i2k3$1@dont-email.me> <20231018102525.515@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 18 Oct 2023 18:31:21 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8b8431092374d68dacb83a2b382dcc61";
logging-data="3996520"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1S4eVJJeM24JKL1qEZE9AA/6JIl/jHrA="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:S44qveFLANpbnDUA1jpOcbNJ88c=
In-Reply-To: <20231018102525.515@kylheku.com>
Content-Language: en-US
 by: Chris M. Thomasson - Wed, 18 Oct 2023 18:31 UTC

On 10/18/2023 10:29 AM, Kaz Kylheku wrote:
> On 2023-10-18, Paavo Helde <eesnimi@osa.pri.ee> wrote:
>> We have been through that, here, long time ago, with a lot of pain and
>> suffering. The consensus reached was that if/when supporting something
>> like garbage collection in C++, only the occupied memory should be
>> released by GC.
>
> Well, this isn't that discussion; it's about a clean up of
> thread-specfic keys when a thread dies.

I must be misunderstanding you here. However, we do not need to create a
thread-specific key on a per thread basis. One key per process works fine.

Re: What does this code print ?

<ugq9hq$4t53$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Wed, 18 Oct 2023 20:58:50 -0700
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <ugq9hq$4t53$1@dont-email.me>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ug66v8$21ehl$1@news.xmission.com> <ug6lk8$1ur0k$2@dont-email.me>
<ugbq8q$19fre$2@i2pn2.org> <uge6f5$3spt4$2@dont-email.me>
<ugebv3$1gabn$1@i2pn2.org> <ugg350$cf8s$4@dont-email.me>
<ugi6jr$ulpp$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 19 Oct 2023 03:58:51 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8e028061df550ac31a2965daca28b7a3";
logging-data="160931"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/sYDhZAZnqILeyloe6QSA+9/6v90GeM2A="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:uQXs25QHBuK9bJ7GkExVmZkG3UQ=
Content-Language: en-US
In-Reply-To: <ugi6jr$ulpp$1@dont-email.me>
 by: Chris M. Thomasson - Thu, 19 Oct 2023 03:58 UTC

On 10/15/2023 7:19 PM, Richard Damon wrote:
> On 10/15/23 3:08 AM, Bonita Montero wrote:
>> Am 14.10.2023 um 17:26 schrieb Richard Damon:
>>
>>> Who said I didn't understand it.
>>
>> You're a nerd and I know nerds.
>
> So, you are wrong, but can't admit it.

Basically, wrt Bonita:
_________
Cruel puppets are one of the most insidious creatures in fantasy worlds.
They use their shapeshifting abilities and sharp tongues to inflict
emotional pain on their victims, often targeting their deepest
insecurities and vulnerabilities.

The cruel puppet's attacks are particularly effective because they are
often unexpected and difficult to defend against. Victims may be tempted
to engage the puppet in a battle of insults, but this is a losing
proposition. The puppet thrives on conflict and will only become more
emboldened by the victim's reactions.

Instead, the best defense against a cruel puppet is to ignore it. This
can be difficult, especially when the puppet is taunting the victim with
personal insults and accusations. However, it is important to remember
that the puppet's words are designed to hurt and should not be taken
seriously.

If the victim can remain calm and collected, the puppet will eventually
lose interest and move on. However, if the victim reacts emotionally,
the puppet will only continue to attack.

In the fantasy world of Gurth, cruel puppets are known to inhabit the
Forest of Youth. During the Great Monster Uprising of the Second Age of
Magic, cruel puppets were also reported in many other regions of the
world, including the abandoned Casino of Port Foozle, the Southern
Wastes, the Coast Road near Borphee, Pheebor, the Forest of Youth, Gurth
Woodland Trail, the Lost Castle of Y'Syska, Crab Island, Egreth Castle,
The Glass Maze, Bozbarland, Largoneth Castle, and the G.U.E. Tech
Training Grounds in the Ethereal Plane of Atrii.

Adventurers who find themselves in these regions should be wary of cruel
puppets. If they encounter one, it is best to avoid it if possible. If
contact is unavoidable, it is important to remain calm and ignore the
puppet's taunts.
_________

Re: What does this code print ?

<ugrqo2$fsmt$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Thu, 19 Oct 2023 19:58:27 +0200
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <ugrqo2$fsmt$1@dont-email.me>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<ugg3c2$ckp0$1@dont-email.me> <ugg3l3$cmg4$1@dont-email.me>
<ugh7s8$1k9qh$3@i2pn2.org> <ugl77t$2pe6u$2@dont-email.me>
<ugnhvc$1t8hq$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 19 Oct 2023 17:58:26 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f255f8991d69103761647ca25fc6cf16";
logging-data="520925"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Fviv00WdhN9O0S2FCsUdqqZvbjtCgN+c="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:2Fxb8vnPT1qjJi5iVAI8JWHS2BU=
In-Reply-To: <ugnhvc$1t8hq$1@i2pn2.org>
Content-Language: de-DE
 by: Bonita Montero - Thu, 19 Oct 2023 17:58 UTC

Am 18.10.2023 um 05:04 schrieb Richard Damon:

> Nope, because they are wrapping an inline function, which is expanded in
> place the two times.

The functions aren't inlined because the function pointers are volatile.
And as you see there's a RET for each function, so this isn't inlined
code.

> Note the name of the symbols, they are "invokers"

If they were invokers the actual code would be called with a CALL
instruction. And if you know assembly you can see that each function
exactly does what the C++ code does.

Re: What does this code print ?

<ugrqok$fto1$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Thu, 19 Oct 2023 19:58:45 +0200
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <ugrqok$fto1$1@dont-email.me>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<ugg3c2$ckp0$1@dont-email.me> <ugg3l3$cmg4$1@dont-email.me>
<ugh7s8$1k9qh$3@i2pn2.org> <ugl77t$2pe6u$2@dont-email.me>
<ugnhvc$1t8hq$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 19 Oct 2023 17:58:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f255f8991d69103761647ca25fc6cf16";
logging-data="521985"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Sh+KoRR4VBmNs6U1Xf5K+Z6x4jKh5df0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:lqWskjkMvKrzNLA/H7UuJsjRqlI=
Content-Language: de-DE
In-Reply-To: <ugnhvc$1t8hq$1@i2pn2.org>
 by: Bonita Montero - Thu, 19 Oct 2023 17:58 UTC

Am 18.10.2023 um 05:04 schrieb Richard Damon:

> Nope, because they are wrapping an inline function, which is expanded in
> place the two times.

The functions aren't inlined because the function pointers are volatile.
And as you see there's a RET for each function, so this isn't inlined
code.

> Note the name of the symbols, they are "invokers"

If they were invokers the actual code would be called with a CALL
instruction. And if you know assembly you can see that each function
exactly does what the C++ code does.

Re: What does this code print ?

<ugrquu$fto1$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!rocksolid2!news.neodome.net!weretis.net!feeder8.news.weretis.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Thu, 19 Oct 2023 20:02:07 +0200
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <ugrquu$fto1$2@dont-email.me>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<ugg3c2$ckp0$1@dont-email.me> <ugh7se$1k9qh$4@i2pn2.org>
<ugl7b1$2pe6u$3@dont-email.me> <ugni73$1t8hq$2@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 19 Oct 2023 18:02:06 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f255f8991d69103761647ca25fc6cf16";
logging-data="521985"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/sg3bfzZBVXnVJ/GZm9BGorcf19dy6fNI="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:CeDy89CFlozTQycTMgXT80JvFYQ=
Content-Language: de-DE
In-Reply-To: <ugni73$1t8hq$2@i2pn2.org>
 by: Bonita Montero - Thu, 19 Oct 2023 18:02 UTC

Am 18.10.2023 um 05:08 schrieb Richard Damon:

> On 10/17/23 1:50 AM, Bonita Montero wrote:

>> You can see from the RET (xxx) that these are separate functions.
>> And the functions couldn't be inlined because I hide them behind
>> volatile function ponters.

> Nope at the final CALL site, it needs to call through the pointer, but
> the pointer needs to create the functions, which are wrappers around a
> single function, which happens to be inlined for the two instances.

I've traced through the code and both functions are directly called
from the volatile function pointers and both functions do what the
C++ code shows. If they would be invokers both functions wouldn't
have to deal with thread-local storate through the FS-segment.

> Do you not understand how inlining works?

The functions aren't inlined because the function pointers are volatile.

Re: What does this code print ?

<ugrqve$fsmt$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Thu, 19 Oct 2023 20:02:23 +0200
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <ugrqve$fsmt$2@dont-email.me>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<ugg3c2$ckp0$1@dont-email.me> <ugh7se$1k9qh$4@i2pn2.org>
<ugl7b1$2pe6u$3@dont-email.me> <ugni73$1t8hq$2@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 19 Oct 2023 18:02:22 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f255f8991d69103761647ca25fc6cf16";
logging-data="520925"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ONmZ9ND+fUOsJzu31LbU9mx6/WhwfeAY="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:vR6prsb40u9FtFI1Kwc1n/ANTAQ=
Content-Language: de-DE
In-Reply-To: <ugni73$1t8hq$2@i2pn2.org>
 by: Bonita Montero - Thu, 19 Oct 2023 18:02 UTC

Am 18.10.2023 um 05:08 schrieb Richard Damon:

> On 10/17/23 1:50 AM, Bonita Montero wrote:

>> You can see from the RET (xxx) that these are separate functions.
>> And the functions couldn't be inlined because I hide them behind
>> volatile function ponters.

> Nope at the final CALL site, it needs to call through the pointer, but
> the pointer needs to create the functions, which are wrappers around a
> single function, which happens to be inlined for the two instances.

I've traced through the code and both functions are directly called
from the volatile function pointers and both functions do what the
C++ code shows. If they would be invokers both functions wouldn't
have to deal with thread-local storate through the FS-segment.

> Do you not understand how inlining works?

The functions aren't inlined because the function pointers are volatile.

Re: What does this code print ?

<20231019110532.810@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.network!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Thu, 19 Oct 2023 18:06:29 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <20231019110532.810@kylheku.com>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<ugg3c2$ckp0$1@dont-email.me> <ugg3l3$cmg4$1@dont-email.me>
<ugh7s8$1k9qh$3@i2pn2.org> <ugl77t$2pe6u$2@dont-email.me>
<ugnhvc$1t8hq$1@i2pn2.org> <ugrqok$fto1$1@dont-email.me>
Injection-Date: Thu, 19 Oct 2023 18:06:29 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c774dd98385cac860b2233be0cdc7715";
logging-data="518436"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18OrSTP8Okn58ZMFrh5IA6RfdD/SajiS2E="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:y2jXsQbVF/ZVJM7Fxl0MmCcVQHw=
 by: Kaz Kylheku - Thu, 19 Oct 2023 18:06 UTC

On 2023-10-19, Bonita Montero <Bonita.Montero@gmail.com> wrote:
> Am 18.10.2023 um 05:04 schrieb Richard Damon:
>
>> Nope, because they are wrapping an inline function, which is expanded in
>> place the two times.
>
> The functions aren't inlined because the function pointers are volatile.
> And as you see there's a RET for each function, so this isn't inlined
> code.

Can you point to any documentation (MSDN?) that would give us confidence
that all which happened is a committed, robust feature that will work
across different versions of MSVC, with different code generation
options?

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: What does this code print ?

<ugrrh1$fto1$4@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Thu, 19 Oct 2023 20:11:46 +0200
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <ugrrh1$fto1$4@dont-email.me>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<ugg3c2$ckp0$1@dont-email.me> <ugg3l3$cmg4$1@dont-email.me>
<ugh7s8$1k9qh$3@i2pn2.org> <ugl77t$2pe6u$2@dont-email.me>
<ugnhvc$1t8hq$1@i2pn2.org> <ugrqok$fto1$1@dont-email.me>
<20231019110532.810@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 19 Oct 2023 18:11:45 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f255f8991d69103761647ca25fc6cf16";
logging-data="521985"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19qRg48O3Q8qb/HRp7M4nAwo84XfxIZ28E="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:7+yZIaAtmkZP8UrCkVER10+xk6Y=
In-Reply-To: <20231019110532.810@kylheku.com>
Content-Language: de-DE
 by: Bonita Montero - Thu, 19 Oct 2023 18:11 UTC

Am 19.10.2023 um 20:06 schrieb Kaz Kylheku:

> Can you point to any documentation (MSDN?) that would give us confidence
> that all which happened is a committed, robust feature that will work
> across different versions of MSVC, with different code generation
> options?

Which option do you think would make MSVC drop the optimization barrier
of volatile function pointers ? The only volatile compiler option is
ISO or MSVC volatile behaviour.

Re: What does this code print ?

<ugrt5f$238ca$2@i2pn2.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!.POSTED!not-for-mail
From: rich...@damon-family.org (Richard Damon)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Thu, 19 Oct 2023 14:39:43 -0400
Organization: i2pn2 (i2pn.org)
Message-ID: <ugrt5f$238ca$2@i2pn2.org>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<ugg3c2$ckp0$1@dont-email.me> <ugg3l3$cmg4$1@dont-email.me>
<ugh7s8$1k9qh$3@i2pn2.org> <ugl77t$2pe6u$2@dont-email.me>
<ugnhvc$1t8hq$1@i2pn2.org> <ugrqo2$fsmt$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 19 Oct 2023 18:39:43 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="2204042"; mail-complaints-to="usenet@i2pn2.org";
posting-account="diqKR1lalukngNWEqoq9/uFtbkm5U+w3w6FQ0yesrXg";
User-Agent: Mozilla Thunderbird
In-Reply-To: <ugrqo2$fsmt$1@dont-email.me>
Content-Language: en-US
 by: Richard Damon - Thu, 19 Oct 2023 18:39 UTC

On 10/19/23 1:58 PM, Bonita Montero wrote:
> Am 18.10.2023 um 05:04 schrieb Richard Damon:
>
>> Nope, because they are wrapping an inline function, which is expanded
>> in place the two times.
>
> The functions aren't inlined because the function pointers are volatile.
> And as you see there's a RET for each function, so this isn't inlined
> code.
>
>> Note the name of the symbols, they are "invokers"
>
> If they were invokers the actual code would be called with a CALL
> instruction. And if you know assembly you can see that each function
> exactly does what the C++ code does.

Not if they were invoking an inline function.

And yes, that is what happens when you inline a function multiple times.

At the C++ language level, they are all the same function, it just
exists in multiple places in memory.

You seem to go by what you think is happening, not by what is defined to
happen.

Re: What does this code print ?

<ugrtce$238ca$3@i2pn2.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!.POSTED!not-for-mail
From: rich...@damon-family.org (Richard Damon)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Thu, 19 Oct 2023 14:43:26 -0400
Organization: i2pn2 (i2pn.org)
Message-ID: <ugrtce$238ca$3@i2pn2.org>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<ugg3c2$ckp0$1@dont-email.me> <ugh7se$1k9qh$4@i2pn2.org>
<ugl7b1$2pe6u$3@dont-email.me> <ugni73$1t8hq$2@i2pn2.org>
<ugrquu$fto1$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 19 Oct 2023 18:43:26 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="2204042"; mail-complaints-to="usenet@i2pn2.org";
posting-account="diqKR1lalukngNWEqoq9/uFtbkm5U+w3w6FQ0yesrXg";
User-Agent: Mozilla Thunderbird
In-Reply-To: <ugrquu$fto1$2@dont-email.me>
Content-Language: en-US
 by: Richard Damon - Thu, 19 Oct 2023 18:43 UTC

On 10/19/23 2:02 PM, Bonita Montero wrote:
> Am 18.10.2023 um 05:08 schrieb Richard Damon:
>
>> On 10/17/23 1:50 AM, Bonita Montero wrote:
>
>>> You can see from the RET (xxx) that these are separate functions.
>>> And the functions couldn't be inlined because I hide them behind
>>> volatile function ponters.
>
>> Nope at the final CALL site, it needs to call through the pointer, but
>> the pointer needs to create the functions, which are wrappers around a
>> single function, which happens to be inlined for the two instances.
>
> I've traced through the code and both functions are directly called
> from the volatile function pointers and both functions do what the
> C++ code shows. If they would be invokers both functions wouldn't
> have to deal with thread-local storate through the FS-segment.

Yes, the call through the pointer isn't inlined, because that would
violate the symantics of the volatile.

The calls inside the invokers IS inlined, because there it know exactly
what function is being called.

So, you are seeing two invoker thunks to the same function, but that
function has been inlined into the two invoker thunks.

>
>> Do you not understand how inlining works?
>
> The functions aren't inlined because the function pointers are volatile.
>

So, you don't understand what happens when you take the address of an
inline function?

Re: What does this code print ?

<20231019120451.638@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!news.nntp4.net!news.gegeweb.eu!gegeweb.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Thu, 19 Oct 2023 19:20:39 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <20231019120451.638@kylheku.com>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<ugg3c2$ckp0$1@dont-email.me> <ugg3l3$cmg4$1@dont-email.me>
<ugh7s8$1k9qh$3@i2pn2.org> <ugl77t$2pe6u$2@dont-email.me>
<ugnhvc$1t8hq$1@i2pn2.org> <ugrqok$fto1$1@dont-email.me>
<20231019110532.810@kylheku.com> <ugrrh1$fto1$4@dont-email.me>
Injection-Date: Thu, 19 Oct 2023 19:20:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c774dd98385cac860b2233be0cdc7715";
logging-data="561597"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+0y9TZBK+f/Nw6QGO8F66St3Xa6KQr3H8="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:OMTqzTKlly1gacPGJJ0sFM3Y9Xw=
 by: Kaz Kylheku - Thu, 19 Oct 2023 19:20 UTC

On 2023-10-19, Bonita Montero <Bonita.Montero@gmail.com> wrote:
> Am 19.10.2023 um 20:06 schrieb Kaz Kylheku:
>
>> Can you point to any documentation (MSDN?) that would give us confidence
>> that all which happened is a committed, robust feature that will work
>> across different versions of MSVC, with different code generation
>> options?
>
> Which option do you think would make MSVC drop the optimization barrier
> of volatile function pointers? The only volatile compiler option is
> ISO or MSVC volatile behaviour.

Possibly, options that turn off optimization entirely, so that the barrier is not
considered.

It's the wrong question. What piece of documentation specifies that
there is such an optimization barrier? Not just the optimization
barrier, but an optimization barrier that causes calling convention
attributes from a pointer to regenerate the called function body.

Where did you get this belief?

It is really weird. It similar to a situation like:

struct foo { int x; int y } foo_obj = { 1, 2 };
struct bar { int y; int x };

bar *volatile bar_ptr = (struct bar *) &foo_obj;

printf("%d\n", bar_ptr->x); // unexpectedly prints 1

Wee, the compiler fixed up the ->x reference to the correct offset
through the wrong type.

The code looks flatly wrong in the abstract semantics, because a
function not defined with any calling convention attributes (and thus
"__cdecl") is being called with incompatible calling conventions.

In the abstract semantics without optimization, of course we expect real
function calls to be attempted.

A plausible explanation for the observed behavior is that the
function got inlined first, and then due to the volatile, it was
de-inlined, and this happened in such a way that the calling conventions
from the pointer influenced the code generation.

Where is that aspect of it documented?

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: What does this code print ?

<ugs28l$238c9$2@i2pn2.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!.POSTED!not-for-mail
From: rich...@damon-family.org (Richard Damon)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Thu, 19 Oct 2023 16:06:45 -0400
Organization: i2pn2 (i2pn.org)
Message-ID: <ugs28l$238c9$2@i2pn2.org>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<ugg3c2$ckp0$1@dont-email.me> <ugg3l3$cmg4$1@dont-email.me>
<ugh7s8$1k9qh$3@i2pn2.org> <ugl77t$2pe6u$2@dont-email.me>
<ugnhvc$1t8hq$1@i2pn2.org> <ugrqok$fto1$1@dont-email.me>
<20231019110532.810@kylheku.com> <ugrrh1$fto1$4@dont-email.me>
<20231019120451.638@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 19 Oct 2023 20:06:45 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="2204041"; mail-complaints-to="usenet@i2pn2.org";
posting-account="diqKR1lalukngNWEqoq9/uFtbkm5U+w3w6FQ0yesrXg";
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <20231019120451.638@kylheku.com>
 by: Richard Damon - Thu, 19 Oct 2023 20:06 UTC

On 10/19/23 3:20 PM, Kaz Kylheku wrote:
> On 2023-10-19, Bonita Montero <Bonita.Montero@gmail.com> wrote:
>> Am 19.10.2023 um 20:06 schrieb Kaz Kylheku:
>>
>>> Can you point to any documentation (MSDN?) that would give us confidence
>>> that all which happened is a committed, robust feature that will work
>>> across different versions of MSVC, with different code generation
>>> options?
>>
>> Which option do you think would make MSVC drop the optimization barrier
>> of volatile function pointers? The only volatile compiler option is
>> ISO or MSVC volatile behaviour.
>
> Possibly, options that turn off optimization entirely, so that the barrier is not
> considered.

Turning off optimizations says that definitely the volatile barrier will
be obeyed. The question

>
> It's the wrong question. What piece of documentation specifies that
> there is such an optimization barrier? Not just the optimization
> barrier, but an optimization barrier that causes calling convention
> attributes from a pointer to regenerate the called function body.
>
> Where did you get this belief?

Well, since the pointer is volatile, the compiler can not assume it
points to the function that the pointer was set to.

>
> It is really weird. It similar to a situation like:
>
> struct foo { int x; int y } foo_obj = { 1, 2 };
> struct bar { int y; int x };
>
> bar *volatile bar_ptr = (struct bar *) &foo_obj;
>
> printf("%d\n", bar_ptr->x); // unexpectedly prints 1
>
> Wee, the compiler fixed up the ->x reference to the correct offset
> through the wrong type.
>
> The code looks flatly wrong in the abstract semantics, because a
> function not defined with any calling convention attributes (and thus
> "__cdecl") is being called with incompatible calling conventions.
>
> In the abstract semantics without optimization, of course we expect real
> function calls to be attempted.
>
> A plausible explanation for the observed behavior is that the
> function got inlined first, and then due to the volatile, it was
> de-inlined, and this happened in such a way that the calling conventions
> from the pointer influenced the code generation.
>
> Where is that aspect of it documented?
>

WHat I see is that we have, as you say, a pointer to a _cdecl function
being assigned to a different calling convention pointer, so the
compiler builds a thunk or an "invoker" that accepts a call by the
specified convention, and then "calls" the specified function. Since
that function is inlinable, that call just become an inline instance of
the function. At THIS point, we don't have the volatile barrier, so the
inlining is possible.

Re: What does this code print ?

<ugs7tb$j12c$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!news.swapon.de!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Thu, 19 Oct 2023 14:43:08 -0700
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <ugs7tb$j12c$1@dont-email.me>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<20231013081459.652@kylheku.com> <ugc8bo$3cv2m$1@dont-email.me>
<20231013192405.57@kylheku.com> <ugdkql$3p94s$1@dont-email.me>
<ugmk55$347g6$2@dont-email.me> <20231017125440.439@kylheku.com>
<ugo5ra$3i2k3$1@dont-email.me> <20231018102525.515@kylheku.com>
<ugp89p$3pur8$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 19 Oct 2023 21:43:08 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8e028061df550ac31a2965daca28b7a3";
logging-data="623692"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+YVzouZfmLDR3r+6BM7fvRbWmf5qSrjbQ="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:0peX7GrfuqEqcQYk0By68V07Hsc=
Content-Language: en-US
In-Reply-To: <ugp89p$3pur8$2@dont-email.me>
 by: Chris M. Thomasson - Thu, 19 Oct 2023 21:43 UTC

On 10/18/2023 11:31 AM, Chris M. Thomasson wrote:
> On 10/18/2023 10:29 AM, Kaz Kylheku wrote:
>> On 2023-10-18, Paavo Helde <eesnimi@osa.pri.ee> wrote:
>>> We have been through that, here, long time ago, with a lot of pain and
>>> suffering. The consensus reached was that if/when supporting something
>>> like garbage collection in C++, only the occupied memory should be
>>> released by GC.
>>
>> Well, this isn't that discussion; it's about a clean up of
>> thread-specfic keys when a thread dies.
>
> I must be misunderstanding you here. However, we do not need to create a
> thread-specific key on a per thread basis. One key per process works fine.
>

Multiple TLS keys per process usually occurs when we load a third party
library.

Re: What does this code print ?

<ugs82g$j12c$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.network!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: What does this code print ?
Date: Thu, 19 Oct 2023 14:45:52 -0700
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <ugs82g$j12c$2@dont-email.me>
References: <ug54sf$1ki2m$1@dont-email.me> <87lec95n0t.fsf@bsb.me.uk>
<ugaeqo$2vefi$1@dont-email.me> <ugapal$31eim$1@dont-email.me>
<ugegmt$3uo8b$1@dont-email.me> <ugg33f$cf8s$3@dont-email.me>
<ugg3c2$ckp0$1@dont-email.me> <ugg3l3$cmg4$1@dont-email.me>
<ugh7s8$1k9qh$3@i2pn2.org> <ugl77t$2pe6u$2@dont-email.me>
<ugnhvc$1t8hq$1@i2pn2.org> <ugrqok$fto1$1@dont-email.me>
<20231019110532.810@kylheku.com> <ugrrh1$fto1$4@dont-email.me>
<20231019120451.638@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 19 Oct 2023 21:45:52 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8e028061df550ac31a2965daca28b7a3";
logging-data="623692"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18pmOMxI1cSIb4F9GNPFJcvqUBH19NvO+Q="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:NIU5LJ1xdtwaspoIYJnR9hc3nos=
In-Reply-To: <20231019120451.638@kylheku.com>
Content-Language: en-US
 by: Chris M. Thomasson - Thu, 19 Oct 2023 21:45 UTC

On 10/19/2023 12:20 PM, Kaz Kylheku wrote:
> On 2023-10-19, Bonita Montero <Bonita.Montero@gmail.com> wrote:
>> Am 19.10.2023 um 20:06 schrieb Kaz Kylheku:
>>
>>> Can you point to any documentation (MSDN?) that would give us confidence
>>> that all which happened is a committed, robust feature that will work
>>> across different versions of MSVC, with different code generation
>>> options?
>>
>> Which option do you think would make MSVC drop the optimization barrier
>> of volatile function pointers? The only volatile compiler option is
>> ISO or MSVC volatile behaviour.
>
> Possibly, options that turn off optimization entirely, so that the barrier is not
> considered.
>
> It's the wrong question. What piece of documentation specifies that
> there is such an optimization barrier? Not just the optimization
> barrier, but an optimization barrier that causes calling convention
> attributes from a pointer to regenerate the called function body.
>
> Where did you get this belief?
>
> It is really weird. It similar to a situation like:
>
> struct foo { int x; int y } foo_obj = { 1, 2 };
> struct bar { int y; int x };
>
> bar *volatile bar_ptr = (struct bar *) &foo_obj;
^^^^^^^^^^^^^^^^^

Nasal demons regardless of volatile?

>
> printf("%d\n", bar_ptr->x); // unexpectedly prints 1
>
> Wee, the compiler fixed up the ->x reference to the correct offset
> through the wrong type.
>
> The code looks flatly wrong in the abstract semantics, because a
> function not defined with any calling convention attributes (and thus
> "__cdecl") is being called with incompatible calling conventions.
>
> In the abstract semantics without optimization, of course we expect real
> function calls to be attempted.
>
> A plausible explanation for the observed behavior is that the
> function got inlined first, and then due to the volatile, it was
> de-inlined, and this happened in such a way that the calling conventions
> from the pointer influenced the code generation.
>
> Where is that aspect of it documented?
>


devel / comp.lang.c++ / Re: What does this code print ?

Pages:123456
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor