Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #92556 > unrolled thread

What does this code print ?

Started byBonita Montero <Bonita.Montero@gmail.com>
First post2023-10-11 05:30 +0200
Last post2023-10-25 23:12 -0700
Articles 20 on this page of 134 — 12 participants

Back to article view | Back to comp.lang.c++


Contents

  What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-11 05:30 +0200
    Re: What does this code print ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-10-11 14:03 +0100
      Re: What does this code print ? gazelle@shell.xmission.com (Kenny McCormack) - 2023-10-11 13:12 +0000
        Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-11 19:22 +0200
          Re: What does this code print ? scott@slp53.sl.home (Scott Lurndal) - 2023-10-11 17:41 +0000
            Re: What does this code print ? Bo Persson <bo@bo-persson.se> - 2023-10-11 20:24 +0200
            Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-13 05:24 +0200
              Re: What does this code print ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-10-13 17:53 +0100
                Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-14 15:50 +0200
          Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-13 12:12 -0400
            Re: What does this code print ? scott@slp53.sl.home (Scott Lurndal) - 2023-10-13 17:27 +0000
            Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-14 15:52 +0200
              Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-14 11:26 -0400
                Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-15 09:08 +0200
                  Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-15 12:55 -0700
                  Re: What does this code print ? Richard Damon <news.x.richarddamon@xoxy.net> - 2023-10-15 22:19 -0400
                    Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-18 20:58 -0700
      Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-11 19:21 +0200
      Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-11 12:41 -0700
        Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-11 12:43 -0700
        Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-13 05:25 +0200
      Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-12 20:50 -0700
        Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-13 08:50 +0200
          Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-13 12:15 -0400
            Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-14 15:53 +0200
              Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-14 11:26 -0400
                Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-15 09:00 +0200
                  Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-15 13:15 -0400
                    Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-17 07:47 +0200
                      Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-17 11:34 -0700
          Re: What does this code print ? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-10-13 16:34 +0000
            Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-13 13:12 -0700
              Re: What does this code print ? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-10-14 02:36 +0000
                Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-13 20:44 -0700
                Re: What does this code print ? Paavo Helde <eesnimi@osa.pri.ee> - 2023-10-14 11:51 +0300
                  Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-17 11:35 -0700
                    Re: What does this code print ? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-10-17 20:06 +0000
                      Re: What does this code print ? Paavo Helde <eesnimi@osa.pri.ee> - 2023-10-18 11:43 +0300
                        Re: What does this code print ? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-10-18 17:29 +0000
                          Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-18 11:31 -0700
                            Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-19 14:43 -0700
            Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-14 15:54 +0200
              Re: What does this code print ? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-10-14 18:05 +0000
                Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-14 14:58 -0400
                Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-15 08:58 +0200
          Re: What does this code print ? Richard Damon <news.x.richarddamon@xoxy.net> - 2023-10-14 12:47 -0400
            Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-15 09:07 +0200
              Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-15 09:12 +0200
                Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-15 09:16 +0200
                  Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-15 13:35 -0400
                    Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-17 07:48 +0200
                      Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-17 23:04 -0400
                        Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-19 19:58 +0200
                          Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-19 14:39 -0400
                        Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-19 19:58 +0200
                          Re: What does this code print ? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-10-19 18:06 +0000
                            Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-19 20:11 +0200
                              Re: What does this code print ? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-10-19 19:20 +0000
                                Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-19 16:06 -0400
                                Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-19 14:45 -0700
                                  Re: What does this code print ? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-10-19 23:26 +0000
                                    Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-20 09:19 +0200
                                      Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-20 05:47 -0400
                                        Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-20 17:59 +0200
                                          Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-20 19:16 -0700
                                            Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-21 08:02 +0200
                                              Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-21 08:38 -0700
                                                Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-21 19:40 +0200
                                                  Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-21 10:54 -0700
                                                    Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-21 20:34 +0200
                                                      Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-21 12:45 -0700
                                                        Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-22 04:18 +0200
                                                          Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-21 19:28 -0700
                                                            Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-22 06:53 +0200
                                                              Re: What does this code print ? Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2023-10-22 09:59 +0000
                                                              Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-22 07:12 -0700
                                                                Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-23 19:05 +0200
                                                                  Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-23 10:40 -0700
                                                                    Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-24 16:03 +0200
                                                                      Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-24 07:28 -0700
                                                                        Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-24 17:01 +0200
                                                                          Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-24 08:28 -0700
                                                                            Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-24 18:27 +0200
                                                                              Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-24 10:05 -0700
                                                                                Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-24 19:08 +0200
                                                                                  Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-24 10:39 -0700
                                                                                    Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-24 20:25 +0200
                                                                                      Re: What does this code print ? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-10-24 19:48 +0000
                                                                                        Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-25 10:54 +0200
                                                                                          Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-25 08:43 -0700
                                                                                            Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-25 17:57 +0200
                                                                          Re: What does this code print ? Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2023-10-24 16:40 +0000
                                                                            Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-24 19:07 +0200
                                                                        Re: What does this code print ? scott@slp53.sl.home (Scott Lurndal) - 2023-10-24 15:25 +0000
                                                                          Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-24 08:34 -0700
                                                                      Re: What does this code print ? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-10-24 16:34 +0000
                                                                        Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-24 19:05 +0200
                                      Re: What does this code print ? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-10-20 14:50 +0000
                                        Re: What does this code print ? Bo Persson <bo@bo-persson.se> - 2023-10-20 17:34 +0200
                                          Re: What does this code print ? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-10-20 15:59 +0000
                                        Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-20 18:00 +0200
                                          Re: What does this code print ? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-10-20 16:06 +0000
                                            Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-20 18:40 +0200
                                              Re: What does this code print ? gazelle@shell.xmission.com (Kenny McCormack) - 2023-10-20 20:07 +0000
                                                Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-21 08:04 +0200
                Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-15 13:35 -0400
                  Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-17 07:50 +0200
                    Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-17 23:08 -0400
                      Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-19 20:02 +0200
                        Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-19 14:43 -0400
                      Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-19 20:02 +0200
              Re: What does this code print ? scott@slp53.sl.home (Scott Lurndal) - 2023-10-15 14:36 +0000
                Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-15 18:15 +0200
                  Re: What does this code print ? Richard Damon <news.x.richarddamon@xoxy.net> - 2023-10-15 22:23 -0400
                    Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-17 07:51 +0200
                      Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-17 23:08 -0400
              Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-15 13:25 -0400
          Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-14 11:33 -0700
            Re: What does this code print ? Paavo Helde <eesnimi@osa.pri.ee> - 2023-10-14 21:54 +0300
              Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-14 11:56 -0700
              Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-24 15:53 -0700
                Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-25 15:07 +0200
                  Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-25 08:43 -0700
                    Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-25 18:01 +0200
                      Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-25 09:21 -0700
                        Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-25 18:24 +0200
                          Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-25 11:23 -0700
                            Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-25 15:02 -0700
                            Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-26 07:13 +0200
                              Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-25 23:09 -0700
                          Re: What does this code print ? James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-10-25 23:55 -0400
                      Re: What does this code print ? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-10-25 15:01 -0700
                        Re: What does this code print ? Bonita Montero <Bonita.Montero@gmail.com> - 2023-10-26 07:15 +0200
                          Re: What does this code print ? Richard Damon <richard@damon-family.org> - 2023-10-25 23:12 -0700

Page 4 of 7 — ← Prev page 1 2 3 [4] 5 6 7  Next page →


#94130

FromKaz Kylheku <864-117-4973@kylheku.com>
Date2023-10-19 23:26 +0000
Message-ID<20231019162423.200@kylheku.com>
In reply to#94129
On 2023-10-19, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
> 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?

Yes; like in the original code. Calling a function through
incompatible calling conventions is (compiler-specific) nasal demons
(unless the situation is documented otherwise).

It seems like an unintended fluke that the inlining and
deinlining of the function squeezes out that problem.

[toc] | [prev] | [next] | [standalone]


#94218

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-10-20 09:19 +0200
Message-ID<ugt9lg$ue68$1@dont-email.me>
In reply to#94130
Am 20.10.2023 um 01:26 schrieb Kaz Kylheku:

> Yes; like in the original code. Calling a function through
> incompatible calling conventions is (compiler-specific)
> nasal demons (unless the situation is documented otherwise).

The calling convention isn't incompatible but the lambda
is compiled twice.

[toc] | [prev] | [next] | [standalone]


#94226

FromRichard Damon <richard@damon-family.org>
Date2023-10-20 05:47 -0400
Message-ID<ugtiar$26i7n$2@i2pn2.org>
In reply to#94218
On 10/20/23 3:19 AM, Bonita Montero wrote:
> Am 20.10.2023 um 01:26 schrieb Kaz Kylheku:
> 
>> Yes; like in the original code. Calling a function through
>> incompatible calling conventions is (compiler-specific)
>> nasal demons (unless the situation is documented otherwise).
> 
> The calling convention isn't incompatible but the lambda
> is compiled twice.

No, the compiler seems to decide to create a conversion thunk to fix the 
calling convention and then includes the lambda inline in that thunk.

It "Compiled" it once into the internal coding, but generated code 
twice, as it was used inline twice.

[toc] | [prev] | [next] | [standalone]


#94260

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-10-20 17:59 +0200
Message-ID<ugu84s$1685u$1@dont-email.me>
In reply to#94226
Am 20.10.2023 um 11:47 schrieb Richard Damon:

> No, the compiler seems to decide to create a conversion thunk to fix the 
> calling convention and then includes the lambda inline in that thunk.

No, theres no CALL inside my assembly. And for parameters which are
non-trivial objects that are on the  stack this wouldn't work since
they would have to be copy-constructed; no one would accept that.

[toc] | [prev] | [next] | [standalone]


#94321

FromRichard Damon <richard@damon-family.org>
Date2023-10-20 19:16 -0700
Message-ID<ugvca1$2918j$1@i2pn2.org>
In reply to#94260
On 10/20/23 8:59 AM, Bonita Montero wrote:
> Am 20.10.2023 um 11:47 schrieb Richard Damon:
> 
>> No, the compiler seems to decide to create a conversion thunk to fix 
>> the calling convention and then includes the lambda inline in that thunk.
> 
> No, theres no CALL inside my assembly. And for parameters which are
> non-trivial objects that are on theĀ  stack this wouldn't work since
> they would have to be copy-constructed; no one would accept that.

So, you don't understand what it means to inline code?

Or, how thunks work.

[toc] | [prev] | [next] | [standalone]


#94360

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-10-21 08:02 +0200
Message-ID<ugvpi4$1js55$1@dont-email.me>
In reply to#94321
Am 21.10.2023 um 04:16 schrieb Richard Damon:

> So, you don't understand what it means to inline code?

I've described why the "invoker" can never be a separate function.

[toc] | [prev] | [next] | [standalone]


#94435

FromRichard Damon <richard@damon-family.org>
Date2023-10-21 08:38 -0700
Message-ID<uh0r9b$2b12n$2@i2pn2.org>
In reply to#94360
On 10/20/23 11:02 PM, Bonita Montero wrote:
> Am 21.10.2023 um 04:16 schrieb Richard Damon:
> 
>> So, you don't understand what it means to inline code?
> 
> I've described why the "invoker" can never be a separate function.
> 

Its "called" by the code, so it IS a "function" at the assembly level.

Why do you disagree with clear facts?

Have you tried doing the same thing with a function that can not be 
inlined?

[toc] | [prev] | [next] | [standalone]


#94452

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-10-21 19:40 +0200
Message-ID<uh12dd$1sgmt$1@dont-email.me>
In reply to#94435
Am 21.10.2023 um 17:38 schrieb Richard Damon:

> Its "called" by the code, so it IS a "function" at the assembly level.

Non-trivial objects would have to be copied, so this "invoker"
always inlines.

[toc] | [prev] | [next] | [standalone]


#94458

FromRichard Damon <richard@damon-family.org>
Date2023-10-21 10:54 -0700
Message-ID<uh138s$2b7av$2@i2pn2.org>
In reply to#94452
On 10/21/23 10:40 AM, Bonita Montero wrote:
> Am 21.10.2023 um 17:38 schrieb Richard Damon:
> 
>> Its "called" by the code, so it IS a "function" at the assembly level.
> 
> Non-trivial objects would have to be copied, so this "invoker"
> always inlines.
> 

WHAT non-trival objects? Your example only has ints

Also, tail call elimination can often get rid of some of the copies.

[toc] | [prev] | [next] | [standalone]


#94460

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-10-21 20:34 +0200
Message-ID<uh15j2$1t8j1$1@dont-email.me>
In reply to#94458
Am 21.10.2023 um 19:54 schrieb Richard Damon:

> WHAT non-trival objects? Your example only has ints

I wanted to describe why the "invoker" nearly every time must inline
the lambda because non-trivial objects from the stack couldn't be
copied. I guess MSVC never does that so the name invoker is misleading.

> Also, tail call elimination can often get rid of some of the copies.

Call tail elimination doesn't work if you have different distribution
of parameters on the stack and in the registers.

[toc] | [prev] | [next] | [standalone]


#94462

FromRichard Damon <richard@damon-family.org>
Date2023-10-21 12:45 -0700
Message-ID<uh19ot$2b7au$5@i2pn2.org>
In reply to#94460
On 10/21/23 11:34 AM, Bonita Montero wrote:
> Am 21.10.2023 um 19:54 schrieb Richard Damon:
> 
>> WHAT non-trival objects? Your example only has ints
> 
> I wanted to describe why the "invoker" nearly every time must inline
> the lambda because non-trivial objects from the stack couldn't be
> copied. I guess MSVC never does that so the name invoker is misleading.
> 
>> Also, tail call elimination can often get rid of some of the copies.
> 
> Call tail elimination doesn't work if you have different distribution
> of parameters on the stack and in the registers.
> 
> 

But in this case it made it work! so you are wrong.

[toc] | [prev] | [next] | [standalone]


#94495

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-10-22 04:18 +0200
Message-ID<uh20qf$2705q$1@dont-email.me>
In reply to#94462
Am 21.10.2023 um 21:45 schrieb Richard Damon:

> But in this case it made it work! so you are wrong.

It may work, but actually there's no real "invoker".

[toc] | [prev] | [next] | [standalone]


#94496

FromRichard Damon <richard@damon-family.org>
Date2023-10-21 19:28 -0700
Message-ID<uh21ct$2ck19$1@i2pn2.org>
In reply to#94495
On 10/21/23 7:18 PM, Bonita Montero wrote:
> Am 21.10.2023 um 21:45 schrieb Richard Damon:
> 
>> But in this case it made it work! so you are wrong.
> 
> It may work, but actually there's no real "invoker".
> 

Then why was the symbol called an "invoker"?

[toc] | [prev] | [next] | [standalone]


#94497

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-10-22 06:53 +0200
Message-ID<uh29t3$28g3k$1@dont-email.me>
In reply to#94496
Am 22.10.2023 um 04:28 schrieb Richard Damon:
> On 10/21/23 7:18 PM, Bonita Montero wrote:
>> Am 21.10.2023 um 21:45 schrieb Richard Damon:
>>
>>> But in this case it made it work! so you are wrong.
>>
>> It may work, but actually there's no real "invoker".
>>
> 
> Then why was the symbol called an "invoker"?

The lambda can have an arbitrary size, it is always inlined.

[toc] | [prev] | [next] | [standalone]


#94540

FromBranimir Maksimovic <branimir.maksimovic@icloud.com>
Date2023-10-22 09:59 +0000
Message-ID<lo6ZM.150272$2fS.31013@fx16.iad>
In reply to#94497
On 2023-10-22, Bonita Montero <Bonita.Montero@gmail.com> wrote:
> Am 22.10.2023 um 04:28 schrieb Richard Damon:
>> On 10/21/23 7:18 PM, Bonita Montero wrote:
>>> Am 21.10.2023 um 21:45 schrieb Richard Damon:
>>>
>>>> But in this case it made it work! so you are wrong.
>>>
>>> It may work, but actually there's no real "invoker".
>>>
>> 
>> Then why was the symbol called an "invoker"?
>
> The lambda can have an arbitrary size, it is always inlined.
>
I don't think so...

-- 

7-77-777, Evil Sinner!
https://www.linkedin.com/in/branimir-maksimovic-6762bbaa/

[toc] | [prev] | [next] | [standalone]


#94577

FromRichard Damon <richard@damon-family.org>
Date2023-10-22 07:12 -0700
Message-ID<uh3al6$2ck18$1@i2pn2.org>
In reply to#94497
On 10/21/23 9:53 PM, Bonita Montero wrote:
> Am 22.10.2023 um 04:28 schrieb Richard Damon:
>> On 10/21/23 7:18 PM, Bonita Montero wrote:
>>> Am 21.10.2023 um 21:45 schrieb Richard Damon:
>>>
>>>> But in this case it made it work! so you are wrong.
>>>
>>> It may work, but actually there's no real "invoker".
>>>
>>
>> Then why was the symbol called an "invoker"?
> 
> The lambda can have an arbitrary size, it is always inlined.
> 

Your lambda has a fixed code, not arbitrary size.

In fact, it is likely that it was because your particular lambda was 
small, that it was made to be inline.

Lambdas define a function object, which can be created inline or out of 
line.

[toc] | [prev] | [next] | [standalone]


#94799

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-10-23 19:05 +0200
Message-ID<uh694p$38uv3$1@dont-email.me>
In reply to#94577
Am 22.10.2023 um 16:12 schrieb Richard Damon:

> On 10/21/23 9:53 PM, Bonita Montero wrote:

>> The lambda can have an arbitrary size, it is always inlined.

> Your lambda has a fixed code, not arbitrary size.

What I wanted to say is that the lambda's size can be arbitrary
without having s separate invoker.

> In fact, it is likely that it was because your particular lambda was 
> small, that it was made to be inline.

I did my own index_sequence<...> vs. function-object loop-unrolling
with 1'000 increments of an atomic_char inside the lambda; it was
still inlined.

> Lambdas define a function object, which can be created inline or out of 
> line.

The calling operator of a lambda is inline if it is mutable or
const inline if it is non-mutable. But we don't discuss C++ but
the behaviour of a specific  platform.

[toc] | [prev] | [next] | [standalone]


#94809

FromRichard Damon <richard@damon-family.org>
Date2023-10-23 10:40 -0700
Message-ID<uh6b5h$2fvna$2@i2pn2.org>
In reply to#94799
On 10/23/23 10:05 AM, Bonita Montero wrote:
> Am 22.10.2023 um 16:12 schrieb Richard Damon:
> 
>> On 10/21/23 9:53 PM, Bonita Montero wrote:
> 
>>> The lambda can have an arbitrary size, it is always inlined.
> 
>> Your lambda has a fixed code, not arbitrary size.
> 
> What I wanted to say is that the lambda's size can be arbitrary
> without having s separate invoker.

So? In this case we got an invoker, because we needed something to 
handle the calling convention difference.

> 
>> In fact, it is likely that it was because your particular lambda was 
>> small, that it was made to be inline.
> 
> I did my own index_sequence<...> vs. function-object loop-unrolling
> with 1'000 increments of an atomic_char inside the lambda; it was
> still inlined.

So? The compiler gets to decide under what conditions it wants to inline 
the code. Especially if it can see that the lambda isn't used in many 
places.

> 
>> Lambdas define a function object, which can be created inline or out 
>> of line.
> 
> The calling operator of a lambda is inline if it is mutable or
> const inline if it is non-mutable. But we don't discuss C++ but
> the behaviour of a specificĀ  platform.
> 

You seem to be confusing the calling via a pointer to the lambda, vs the 
actual calling of the lambda.

A "Mutable" lambda means the lambda can modify the parameters it has 
captured. That dosn't affect being inline or not.

ALso, THIS NEWGROUP (comp.lang.c++) is about generic C++ behavior, not 
platform specific behavior. Maybe you should be posting in a group that 
IS about that platform.

[toc] | [prev] | [next] | [standalone]


#95091

FromBonita Montero <Bonita.Montero@gmail.com>
Date2023-10-24 16:03 +0200
Message-ID<uh8irj$3vru6$1@dont-email.me>
In reply to#94809
Am 23.10.2023 um 19:40 schrieb Richard Damon:

> So? In this case we got an invoker, because we needed something to 
> handle the calling convention difference.

It's called invoker, but the actual lambda is always inlined.
So this term is misleading here.

> So? The compiler gets to decide under what conditions it wants to inline 
> the code. Especially if it can see that the lambda isn't used in many 
> places.

Each atomic increment is two instruction, i.e. I've got 2.000
instructions in the actual lambda. If the compiler doesn't inline
that anyway it does this never. Try it yourself on Godbolt if you
want to manage to have s separate invoker.

 >> Lambdas define a function object, which can be created inline or out 
of line.

> You seem to be confusing the calling via a pointer to the lambda, vs the 
> actual calling of the lambda.

You went off topic and I responded. See what you said above.

> A "Mutable" lambda means the lambda can modify the parameters it has 
> captured. That dosn't affect being inline or not.

I didn't say that.

> ALso, THIS NEWGROUP (comp.lang.c++) is about generic C++ behavior, not 
> platform specific behavior. ...

That's your opinion.

[toc] | [prev] | [next] | [standalone]


#95112

FromRichard Damon <richard@damon-family.org>
Date2023-10-24 07:28 -0700
Message-ID<uh8kab$2ld7m$1@i2pn2.org>
In reply to#95091
On 10/24/23 7:03 AM, Bonita Montero wrote:
> Am 23.10.2023 um 19:40 schrieb Richard Damon:
> 
>> So? In this case we got an invoker, because we needed something to 
>> handle the calling convention difference.
> 
> It's called invoker, but the actual lambda is always inlined.
> So this term is misleading here.

Why do you say that? The "invoker" is a function created to invoke the 
designated function in an environment (calling convention) that the 
function can not directly handle.

"invoking" doesn't need a "call" instruction, as when you invoke an 
"inline" function, the function is just put there.

Note also, the fact that you are agreeing that this code was an inline 
expansion leads to the questions, what is it inline expanded into, the 
answer to that are the two invokers that handle the calling convention 
mismatch. Thus we don't have two versions of the lambda recompiled to 
different calling conventions, but two inline instances of the exact 
same lambda, embedded in two invokers that have different calling 
conventions.

> 
>> So? The compiler gets to decide under what conditions it wants to 
>> inline the code. Especially if it can see that the lambda isn't used 
>> in many places.
> 
> Each atomic increment is two instruction, i.e. I've got 2.000
> instructions in the actual lambda. If the compiler doesn't inline
> that anyway it does this never. Try it yourself on Godbolt if you
> want to manage to have s separate invoker.
> 
>  >> Lambdas define a function object, which can be created inline or out 
> of line.
> 
>> You seem to be confusing the calling via a pointer to the lambda, vs 
>> the actual calling of the lambda.
> 
> You went off topic and I responded. See what you said above.
> 
>> A "Mutable" lambda means the lambda can modify the parameters it has 
>> captured. That dosn't affect being inline or not.
> 
> I didn't say that.

You said:

> The calling operator of a lambda is inline if it is mutable or
> const inline if it is non-mutable. But we don't discuss C++ but
> the behaviour of a specific  platform.

So, you said that mutability affected inlining.

So, I guess you don't know what you are saying.

> 
>> ALso, THIS NEWGROUP (comp.lang.c++) is about generic C++ behavior, not 
>> platform specific behavior. ...
> 
> That's your opinion.
> 
> 

That's the newsgroup charter, not

[toc] | [prev] | [next] | [standalone]


Page 4 of 7 — ← Prev page 1 2 3 [4] 5 6 7  Next page →

Back to top | Article view | comp.lang.c++


csiph-web