Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

C++ move constructors

194 views
Skip to first unread message

blt_4f...@yds5iz0up4o1.gov.uk

unread,
Mar 4, 2019, 5:03:43 AM3/4/19
to
Regarding the 2011 move constructors - do compilers actually generate
different code for the given class compared to if it had a standard copy
constructor, or are the && move semantics simply a way of indicating to any
maintenance coders that this constructor will do a move not a copy?

ie would the object code for these skeleton constructors:

myclass(const myclass &rhs)
{
// Do nothing
}


myclass(const myclass &&rhs)
{
// Do nothing
}

be different?



Öö Tiib

unread,
Mar 4, 2019, 6:00:15 AM3/4/19
to
You seem bit confused, sorry. It is hard to decide from where
to start.

1) Perhaps first thing is that ... rvalue reference to const is confusing
construct and so there is hard to see any usage for it.
2) Second is that you used it as parameter of constructor. It is not
possible to move from const object so the second constructor of
yours is *not* move constructor. No "move semantics" involved.
3) Third thing is that C++ compilers !typically! generate no code
for (and even optimize out the calls of) functions that do nothing.
However that (and anything concerning object code and even
existence of such) is not in any way required by standard. Toolchain
that targets asm.js for example generates JavaScript not object
code. So your question about object code also does not make any
sense.

Sam

unread,
Mar 4, 2019, 7:07:40 AM3/4/19
to
blt_4f...@yds5iz0up4o1.gov.uk writes:

> Regarding the 2011 move constructors - do compilers actually generate
> different code for the given class compared to if it had a standard copy
> constructor, or are the && move semantics simply a way of indicating to any
> maintenance coders that this constructor will do a move not a copy?

The copy and move constructors will generate whatever code is necessary to
implement the copy and move constructors, as written.

> ie would the object code for these skeleton constructors:
>
> myclass(const myclass &rhs)
> {
> // Do nothing
> }
>
>
> myclass(const myclass &&rhs)
> {
> // Do nothing
> }
>
> be different?

That's implementation defined. A compiler may generate no code for either
constructor. Or the compiler can choose one of these constructors to
implement the Sieve of Eratosthenes, and immediately throw away the results
in a manner that's not observable. That, of course, is unlikely, but is
certainly permitted.

Alf P. Steinbach

unread,
Mar 4, 2019, 7:19:24 AM3/4/19
to
On 04.03.2019 13:07, Sam wrote:
> blt_4f...@yds5iz0up4o1.gov.uk writes:
>
>> Regarding the 2011 move constructors - do compilers actually generate
>> different code for the given class compared to if it had a standard copy
>> constructor, or are the && move semantics simply a way of indicating
>> to any
>> maintenance coders that this constructor will do a move not a copy?
>
> The copy and move constructors will generate whatever code is necessary
> to implement the copy and move constructors, as written.

The original code defines a copy constructor that default-initializes
all members that don't have initializers, which for POD such members
means doing nothing.

It also defines a weird constructor taking `T const&&` argument, with
the same empty implementation.


>> ie would the object code for these skeleton constructors:
>>
>> myclass(const myclass &rhs)
>> {
>>     // Do nothing
>> }
>>
>>
>> myclass(const myclass &&rhs)
>> {
>>     // Do nothing
>> }
>>
>> be different?
>
> That's implementation defined. A compiler may generate no code for
> either constructor.

No, the general rule for a constructor is that a member that's not
explicitly initialized, either in the constructor or by having an
initializer, is default-constructed.


> Or the compiler can choose one of these constructors
> to implement the Sieve of Eratosthenes, and immediately throw away the
> results in a manner that's not observable. That, of course, is unlikely,
> but is certainly permitted.

Where did you get that from?



Cheers!,

- Alf

blt_u2a...@x5ei40.com

unread,
Mar 4, 2019, 7:35:54 AM3/4/19
to
On Mon, 4 Mar 2019 03:00:05 -0800 (PST)
=?UTF-8?B?w5bDtiBUaWli?= <oot...@hot.ee> wrote:
>On Monday, 4 March 2019 12:03:43 UTC+2, blt_4f...@yds5iz0up4o1.gov.uk wrote:
>> Regarding the 2011 move constructors - do compilers actually generate
>> different code for the given class compared to if it had a standard copy
>> constructor, or are the && move semantics simply a way of indicating to any
>> maintenance coders that this constructor will do a move not a copy?
>>
>> ie would the object code for these skeleton constructors:
>>
>> myclass(const myclass &rhs)
>> {
>> // Do nothing
>> }
>>
>>
>> myclass(const myclass &&rhs)
>> {
>> // Do nothing
>> }
>>
>> be different?
>
>You seem bit confused, sorry. It is hard to decide from where
>to start.

Im not confused, I'm simply asking if using && instead of just & changes
compiler behaviour in any way or its simply syntatic sugar to make the
intention of the code clearer for developers.

>3) Third thing is that C++ compilers !typically! generate no code
>for (and even optimize out the calls of) functions that do nothing.
>However that (and anything concerning object code and even
>existence of such) is not in any way required by standard. Toolchain
>that targets asm.js for example generates JavaScript not object
>code. So your question about object code also does not make any
>sense.

Javascript? What? What do you think the .o files generated by C/C++ compilers
are?

blt_jzf...@upb.ac.uk

unread,
Mar 4, 2019, 7:37:52 AM3/4/19
to
On Mon, 04 Mar 2019 07:07:30 -0500
Sam <s...@email-scan.com> wrote:
>This is a MIME GnuPG-signed message. If you see this text, it means that
>your E-mail or Usenet software does not support MIME signed messages.
>The Internet standard for MIME PGP messages, RFC 2015, was published in 1996.
>To open this message correctly you will need to install E-mail or Usenet
>software that supports modern Internet standards.
>
>--=_monster.email-scan.com-40936-1551701250-0001
>Content-Type: text/plain; format=flowed; delsp=yes; charset="UTF-8"
>Content-Disposition: inline
>Content-Transfer-Encoding: 7bit
>
>blt_4f...@yds5iz0up4o1.gov.uk writes:
>
>> Regarding the 2011 move constructors - do compilers actually generate
>> different code for the given class compared to if it had a standard copy
>> constructor, or are the && move semantics simply a way of indicating to any
>> maintenance coders that this constructor will do a move not a copy?
>
>The copy and move constructors will generate whatever code is necessary to
>implement the copy and move constructors, as written.

Thanks, very helpful. Not.

Clearly my question was too sophisticated, I'll rephrase: Does using && instead
of & change the object code generated by the compiler if no other part of the
code is changed?

Öö Tiib

unread,
Mar 4, 2019, 8:11:57 AM3/4/19
to
On Monday, 4 March 2019 14:35:54 UTC+2, blt_u2a...@x5ei40.com wrote:
> On Mon, 4 Mar 2019 03:00:05 -0800 (PST)
> =?UTF-8?B?w5bDtiBUaWli?= <oot...@hot.ee> wrote:
> >On Monday, 4 March 2019 12:03:43 UTC+2, blt_4f...@yds5iz0up4o1.gov.uk wrote:
> >> Regarding the 2011 move constructors - do compilers actually generate
> >> different code for the given class compared to if it had a standard copy
> >> constructor, or are the && move semantics simply a way of indicating to any
> >> maintenance coders that this constructor will do a move not a copy?
> >>
> >> ie would the object code for these skeleton constructors:
> >>
> >> myclass(const myclass &rhs)
> >> {
> >> // Do nothing
> >> }
> >>
> >>
> >> myclass(const myclass &&rhs)
> >> {
> >> // Do nothing
> >> }
> >>
> >> be different?
> >
> >You seem bit confused, sorry. It is hard to decide from where
> >to start.
>
> Im not confused, I'm simply asking if using && instead of just & changes
> compiler behaviour in any way or its simply syntatic sugar to make the
> intention of the code clearer for developers.

Indeed you may be are not confused but just pretending to be
stupid. Perhaps you erased my explanations 1) and 2) to confuse
things up a bit and then reiterate your nonsensical questions. I
can repeat:

1) Perhaps first thing is that ... rvalue reference to const is confusing
construct and so there is hard to see any usage for it.
2) Second is that you used it as parameter of constructor. It is not
possible to move from const object so the second constructor of
yours is *not* move constructor. No "move semantics" involved.

> >3) Third thing is that C++ compilers !typically! generate no code
> >for (and even optimize out the calls of) functions that do nothing.
> >However that (and anything concerning object code and even
> >existence of such) is not in any way required by standard. Toolchain
> >that targets asm.js for example generates JavaScript not object
> >code. So your question about object code also does not make any
> >sense.
>
> Javascript? What? What do you think the .o files generated by C/C++ compilers
> are?

Yes, JavaScript. For code meant to run in web browser. Have you ever
seen a web browser? Well Firefox (from version 22), Safari (from
version 3.1), Edge (from version 13) fully support asm.js. Chrome (from
version 36) and Opera (from version 15) support asm.js partially.

You are talking about particular compiler implementation (perhaps for
particular platform) that generates .o files. Without mentioning those
things the questions about object code generation make no sense.

Öö Tiib

unread,
Mar 4, 2019, 8:20:39 AM3/4/19
to
On Monday, 4 March 2019 14:19:24 UTC+2, Alf P. Steinbach wrote:
> On 04.03.2019 13:07, Sam wrote:
>
> >
> > That's implementation defined. A compiler may generate no code for
> > either constructor.
>
> No, the general rule for a constructor is that a member that's not
> explicitly initialized, either in the constructor or by having an
> initializer, is default-constructed.

Unfortunately it is way more complex and complicated than that.
Consider:

#include <iostream>

struct BadCopier
{
int meaning;
long number;

BadCopier()
: meaning(42)
, number(666)
{ }

// Copy constructor like in OP
BadCopier(BadCopier const&)
{ }
};

int main()
{
BadCopier a;
BadCopier b {a};

std::cout << "a.meaning = " << a.meaning << "\n"
<< "a.number = " << a.number << "\n";
// undefined behavior follows
std::cout << "b.meaning = " << b.meaning << "\n"
<< "b.number = " << b.number << "\n";
}

a.meaning = 42
a.number = 666
b.meaning = 4196608
b.number = 4196032

It apparently did nothing (gcc 8.2.0).

David Brown

unread,
Mar 4, 2019, 8:28:07 AM3/4/19
to
The answer is then equally clear - "maybe - it depends".

If the source code is doing something different, the object code may be
different. But it may also be the same if that achieves the correct
result in the end. Or the compiler might generate different code - or
no code - in different circumstances. Or the compiler might see that
although you have written "copy", in the particular use-case it can do a
"move" for greater efficiency. Or one compiler might handling things
one way, a different compiler might do something else. Or it might be
affected by flags.

There are all sorts of things that affect the generated code. You can't
break it down and say "how does the compiler implement this feature" -
it doesn't even make sense to talk about "the compiler" when there are
many different toolchains used.


I recommend that you take some samples of what you really mean, and try
them out. An excellent tool is <https://godbolt.org> - it's an online
compiler that shows the generated assembly neatly. (You can choose from
a variety of compilers and target processors - pick whatever suits you
best.) Don't forget to choose suitable command-line options, especially
to enable optimisation. (Without optimisation, such tests are meaningless.)

Scott Lurndal

unread,
Mar 4, 2019, 8:58:20 AM3/4/19
to
That should be a very simple experiment for you to try.

blt_x...@uif_e90m4cobh00lil.net

unread,
Mar 4, 2019, 11:16:32 AM3/4/19
to
On Mon, 4 Mar 2019 05:11:47 -0800 (PST)
=?UTF-8?B?w5bDtiBUaWli?= <oot...@hot.ee> wrote:
>Yes, JavaScript. For code meant to run in web browser. Have you ever
>seen a web browser? Well Firefox (from version 22), Safari (from
>version 3.1), Edge (from version 13) fully support asm.js. Chrome (from
>version 36) and Opera (from version 15) support asm.js partially.

Fascinating.

>You are talking about particular compiler implementation (perhaps for
>particular platform) that generates .o files. Without mentioning those
>things the questions about object code generation make no sense.

This is a C++ group, I have no idea why you're talking about javascript
and browsers. Are you drunk?

blt...@taxzz.net

unread,
Mar 4, 2019, 11:19:46 AM3/4/19
to
It is, and I have and the answer to appears to be no, ie && is just syntactic
sugar and does nothing different to &. However I wanted to know if in any
situations it might be more than that.

Paavo Helde

unread,
Mar 4, 2019, 2:38:54 PM3/4/19
to
On 4.03.2019 14:37, blt_jzf...@upb.ac.uk wrote:

> Clearly my question was too sophisticated, I'll rephrase: Does using && instead
> of & change the object code generated by the compiler if no other part of the
> code is changed?

If you accept "no object code generated" to qualify as "change of object
code" then the answer is yes:

void foo(int& x) {}
int main() {
foo(long(1));
}

Does not compile, so no object code generated.


void foo(int&& x) {}
int main() {
foo(long(1));
}

Compiles and works fine.

I am pretty sure someone can also make an example with two valid
programs having different observable behavior (so different object
codes), probably via some template magic.




Manfred

unread,
Mar 4, 2019, 7:48:19 PM3/4/19
to
On 3/4/19 7:37 AM, blt_jzf...@upb.ac.uk wrote:
> Clearly my question was too sophisticated, I'll rephrase: Does using && instead
> of & change the object code generated by the compiler if no other part of the
> code is changed?


==============================================
#include <iostream>
#include <ostream>

class Moveable
{
public:
Moveable(int val_)
: val(val_)
{
std::cout << "Moveable(int)" << std::endl;
}

Moveable(const Moveable& rhs)
: val(rhs.val)
{
std::cout << "Moveable(const Moveable&)" << std::endl;
}

#ifdef ENABLE_MOVE
Moveable(Moveable&& rhs)
: val(rhs.val)
{
rhs.val = 0;
std::cout << "Moveable(Moveable&&)" << std::endl;
}
#endif

Moveable operator + (int i) { return Moveable{val+i}; }

private:
int val;

friend std::ostream& operator << (std::ostream& s, const Moveable& m);
};

std::ostream& operator << (std::ostream& s, const Moveable& m)
{
return s << m.val;
}


void printMoveable(Moveable&& m)
{
std::cout << "printMoveable(Moveable&& m)" << std::endl;

Moveable m2{std::move(m)};
std::cout << "m is " << m << std::endl;
std::cout << "m2 is " << m2 << std::endl;
}

int main()
{
printMoveable(Moveable{1} + 2);
}
==============================================

play with ENABLE_MOVE and see the results

Alf P. Steinbach

unread,
Mar 4, 2019, 8:10:16 PM3/4/19
to
On 04.03.2019 15:39, Stefan Ram wrote:
> main.cpp
>
> #include <iostream>
> #include <ostream>
>
> struct C
> { C(){ ::std::cerr << "A\n"; };
> C( C && c ){ ::std::cerr << "B\n"; } };
>
> int main() { C{ C{} }; }
>
> Transcript
>
> A
>
> Expected by the programmer
>
> A
> B
>
> Say what now?

Try that with a copy constructor.

Are you then still as surprised?


Cheers!,

- Alf


Alf P. Steinbach

unread,
Mar 4, 2019, 8:13:23 PM3/4/19
to
On 04.03.2019 14:20, Öö Tiib wrote:
> On Monday, 4 March 2019 14:19:24 UTC+2, Alf P. Steinbach wrote:
>> On 04.03.2019 13:07, Sam wrote:
>>
>>>
>>> That's implementation defined. A compiler may generate no code for
>>> either constructor.
>>
>> No, the general rule for a constructor is that a member that's not
>> explicitly initialized, either in the constructor or by having an
>> initializer, is default-constructed.
>
> Unfortunately it is way more complex and complicated than that.

No.


> Consider:
>
> #include <iostream>
>
> struct BadCopier
> {
> int meaning;
> long number;
>
> BadCopier()
> : meaning(42)
> , number(666)
> { }
>
> // Copy constructor like in OP
> BadCopier(BadCopier const&)
> { }
> };
>
> int main()
> {
> BadCopier a;
> BadCopier b {a};
>
> std::cout << "a.meaning = " << a.meaning << "\n"
> << "a.number = " << a.number << "\n";
> // undefined behavior follows
> std::cout << "b.meaning = " << b.meaning << "\n"
> << "b.number = " << b.number << "\n";
> }
>
> a.meaning = 42
> a.number = 666
> b.meaning = 4196608
> b.number = 4196032
>
> It apparently did nothing (gcc 8.2.0).

Yes, that's what I wrote.

It's that simple.


Cheers!,

- Alf

Ian Collins

unread,
Mar 4, 2019, 9:33:47 PM3/4/19
to
On 05/03/2019 15:30, Stefan Ram wrote:
> "Alf P. Steinbach" <alf.p.stein...@gmail.com> writes:
>> Try that with a copy constructor.
>> Are you then still as surprised?
>
> I still do not understand what is going on.
>
> I now have written this program:
>
> main.cpp
>
> #include <iostream>
> #include <ostream>
>
> struct C
> { int a;
> C( int const n ): a{ n } { ::std::cerr << "A\n"; };
> C( C const & other ) = delete;
> C( C && other ) = delete; };
>
> int main()
> { C d( C( 1 ) ); ::std::cerr << "d.a = " << d.a << "\n"; }
>
> And old version of clang behaves as expected:
>
> main.cpp:12:5: error: call to deleted constructor of 'C'
> { C d( C( 1 ) );
> ^
>
> . Ok, that clang version is old, but it's not so old
> it doesn't know »= delete«.
>
> But a recent version of gcc compiles this and prints:
>
> A
> d.a = 1

As does recent clang.

--
Ian.

Alf P. Steinbach

unread,
Mar 4, 2019, 9:48:33 PM3/4/19
to
On 05.03.2019 03:30, Stefan Ram wrote:
> "Alf P. Steinbach" <alf.p.stein...@gmail.com> writes:
>> Try that with a copy constructor.
>> Are you then still as surprised?
>
> I still do not understand what is going on.
>
> I now have written this program:
>
> main.cpp
>
> #include <iostream>
> #include <ostream>
>
> struct C
> { int a;
> C( int const n ): a{ n } { ::std::cerr << "A\n"; };
> C( C const & other ) = delete;
> C( C && other ) = delete; };
>
> int main()
> { C d( C( 1 ) ); ::std::cerr << "d.a = " << d.a << "\n"; }
>
> And old version of clang behaves as expected:
>
> main.cpp:12:5: error: call to deleted constructor of 'C'
> { C d( C( 1 ) );
> ^
>
> . Ok, that clang version is old, but it's not so old
> it doesn't know »= delete«.
>
> But a recent version of gcc compiles this and prints:
>
> A
> d.a = 1

C++17 has guaranteed copy construction elision, where earlier standards
just /permitted/ it.

Among other things this lets a function return a value of a type that
can't be copied or moved.

Unfortunately the wording seems to almost be intentionally obfuscated,
it has to do with “materialization” of rvalues. I can't say I entirely
understand it. But then, that's because I refuse to use time on it. :)


Cheers!,

- Alf




Jorgen Grahn

unread,
Mar 5, 2019, 1:49:34 AM3/5/19
to
On Mon, 2019-03-04, blt_jzf...@upb.ac.uk wrote:
> On Mon, 04 Mar 2019 07:07:30 -0500
> Sam <s...@email-scan.com> wrote:
>>blt_4f...@yds5iz0up4o1.gov.uk writes:

Are you switching From: address between every posting? Please don't.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

blt...@_izvfhgugsz.co.uk

unread,
Mar 5, 2019, 4:48:27 AM3/5/19
to
On Mon, 04 Mar 2019 21:38:43 +0200
Paavo Helde <myfir...@osa.pri.ee> wrote:
>On 4.03.2019 14:37, blt_jzf...@upb.ac.uk wrote:
>
>> Clearly my question was too sophisticated, I'll rephrase: Does using &&
>instead
>> of & change the object code generated by the compiler if no other part of the
>
>> code is changed?
>
>If you accept "no object code generated" to qualify as "change of object
>code" then the answer is yes:
>
>void foo(int& x) {}
>int main() {
> foo(long(1));
>}
>
>Does not compile, so no object code generated.
>
>
>void foo(int&& x) {}
>int main() {
> foo(long(1));
>}
>
>Compiles and works fine.

Ok, I'll admit I don't really understand why the 2nd one compiles, its still
passing a literal so why would a move be valid? Can someone explain?

blt_64...@nxy7efemiq.com

unread,
Mar 5, 2019, 4:50:32 AM3/5/19
to
On 5 Mar 2019 06:49:23 GMT
Jorgen Grahn <grahn...@snipabacken.se> wrote:
>On Mon, 2019-03-04, blt_jzf...@upb.ac.uk wrote:
>> On Mon, 04 Mar 2019 07:07:30 -0500
>> Sam <s...@email-scan.com> wrote:
>>>blt_4f...@yds5iz0up4o1.gov.uk writes:
>
>Are you switching From: address between every posting? Please don't.

Unfortunately due to an idiot in another group who thinks its hilarious
to search and replace on my handle in every reply, I've had to resort to a
constantly changing one. When he eventually grows up and stops I'll revert
back to a normal one.

Öö Tiib

unread,
Mar 5, 2019, 5:00:21 AM3/5/19
to
You have good idea, just pretending being idiot.

Ralf Fassel

unread,
Mar 5, 2019, 5:18:01 AM3/5/19
to
* Manfred <inv...@add.invalid>
| Moveable(const Moveable& rhs)
--<snip-snip>--
| Moveable(Moveable&& rhs)

The OPs question was about

Moveable(_const_ Moveable&& rhs)

for the second CTOR.

R'

blt_i39...@xlicr_dm5.com

unread,
Mar 5, 2019, 5:28:43 AM3/5/19
to
On Tue, 5 Mar 2019 02:00:11 -0800 (PST)
=?UTF-8?B?w5bDtiBUaWli?= <oot...@hot.ee> wrote:
>On Monday, 4 March 2019 18:16:32 UTC+2, blt_x...@uif_e90m4cobh00lil.net wrote:
>
>> On Mon, 4 Mar 2019 05:11:47 -0800 (PST)
>> =?UTF-8?B?w5bDtiBUaWli?= <oot...@hot.ee> wrote:
>> >Yes, JavaScript. For code meant to run in web browser. Have you ever
>> >seen a web browser? Well Firefox (from version 22), Safari (from
>> >version 3.1), Edge (from version 13) fully support asm.js. Chrome (from
>> >version 36) and Opera (from version 15) support asm.js partially.
>>
>> Fascinating.
>>
>> >You are talking about particular compiler implementation (perhaps for
>> >particular platform) that generates .o files. Without mentioning those
>> >things the questions about object code generation make no sense.
>>
>> This is a C++ group, I have no idea why you're talking about javascript
>> and browsers. Are you drunk?
>
>You have good idea, just pretending being idiot.

Humour me then genius, what has javascript got to do with C++ move semantics
or .o object files?

Öö Tiib

unread,
Mar 5, 2019, 5:37:20 AM3/5/19
to
You wrote that compiler has to generate code for those constructors.
It is more complicated since in above example it clearly does not need
to generate any code for given constructor.

Paavo Helde

unread,
Mar 5, 2019, 5:43:22 AM3/5/19
to
This is because '&&' does not mean "move", but "rvalue reference". It's
true that move semantics can be implemented safely on top of rvalue
references, but they are still different things.

As the name says, an rvalue reference can be bound to an rvalue, in this
case to the temporary int created as a conversion result from long.

The ordinary non-const & reference cannot be bound to an rvalue, for
safety reasons. This special rule has been in the language over 20 years
and even MSVC conforms to it nowadays.

See e.g. http://thbecker.net/articles/rvalue_references/section_01.html
for more explanations.

Öö Tiib

unread,
Mar 5, 2019, 6:10:42 AM3/5/19
to
You snipped the part where I already explained that your question has
nothing to do with move and move semantics. The .o files are mid-way
translation artifacts in some programming toolchains that have nothing
to do with move semantics. JavaScript was brought as example how
your babble about "object code" are as meaningless as talking about
JavaScript without mentioning C++ Emscripten toolchain.
Stop pretending being idiot since that trait is not overly popular
anywhere.

David Brown

unread,
Mar 5, 2019, 6:16:41 AM3/5/19
to
Did you ever bother to read what Öö wrote, or did you just think it
would be more fun to attack him and insult him?

You made a somewhat confused post about what object code compilers
generate for different C++ source code. Öö was trying to point out to
you that this is not something defined by the language. The language
does not even require a compiler to generate object code - he gave the
example of generating asm.js output.

The wide variety of C++ compilers, options, flags, target chips,
non-native targets, etc., show how meaningless it is to ask "what do
compilers generate here".

So switch off the condescending and smart-ass attitude, ask your
questions, then read the answers. Maybe you'll learn something -
perhaps not an answer to the question you asked, but this is a
discussion group and not a paid-for support line.

Sam

unread,
Mar 5, 2019, 6:59:46 AM3/5/19
to
blt_jzf...@upb.ac.uk writes:

> On Mon, 04 Mar 2019 07:07:30 -0500
> Sam <s...@email-scan.com> wrote:
>
> >The copy and move constructors will generate whatever code is necessary to
> >implement the copy and move constructors, as written.
>
> Thanks, very helpful. Not.
>
> Clearly my question was too sophisticated,

Yes. It was apparently too sophisticated for anyone else to understand.

> I'll rephrase: Does using &&
> instead
> of & change the object code generated by the compiler if no other part of the
> code is changed?

Of course it does. The compiler might even refuse to generate any code at
all, since the resulting code is now ill-formed.


james...@alumni.caltech.edu

unread,
Mar 5, 2019, 10:31:35 AM3/5/19
to
This is a C++ group. I have no idea why you're talking about "the"
generated object code. Are you drunk?

The answers to your questions about the generated object code will have
different answers for different implementations of C++, because the C++
standard only describes requirements on what the behavior should be - it
says nothing about the details of how that behavior should be produced.
Some implementations will not even generate any object code at all,
which was why he brought up, as an extreme example, an implementation
that generates javascript instead of object code.

If you specify a particular implementation that you're talking about,
your question would make more sense, though it would be better to ask
your question in a forum specific to that implementation.

If you can convert your question into one about the required behavior
rather than the generated object code, then this would be the right
newsgroup to ask it in.

Alf P. Steinbach

unread,
Mar 5, 2019, 10:55:49 AM3/5/19
to
No, I wrote that Sam's claim "That's implementation defined" is wrong,
/and/ I pointed out that default construction does nothing for POD.


> It is more complicated since in above example it clearly does not need
> to generate any code for given constructor.

This claim, that doing nothing is more complicated than doing nothing,
is absurd.

You need coffee.


Cheers!,

- Alf


blt_a...@3depem2rtoo4k9_kbk9ri.gov

unread,
Mar 5, 2019, 11:06:27 AM3/5/19
to
On Tue, 5 Mar 2019 03:10:32 -0800 (PST)
I'm sorry, I should have realised that you don't actually have an answer
to my question but being desperate for something to say you decided to be
a pathetic pedant about the meaning of "object code" which was obviously
confusing you.

>your babble about "object code" are as meaningless as talking about
>JavaScript without mentioning C++ Emscripten toolchain.
>Stop pretending being idiot since that trait is not overly popular
>anywhere.

Or perhaps your English isn't as good as you think it is.

blt_t6t...@qrzz1g0rb.ac.uk

unread,
Mar 5, 2019, 11:08:36 AM3/5/19
to
And that is relevant to my question how exactly? I said object code, I could
easily have just said output.

>The wide variety of C++ compilers, options, flags, target chips,
>non-native targets, etc., show how meaningless it is to ask "what do
>compilers generate here".

Oh ok. So any question regarding the output of a compiler is meaningless
is it because there could be multiple output types?

>So switch off the condescending and smart-ass attitude, ask your

I suggest you take your own advice.

>questions, then read the answers. Maybe you'll learn something -
>perhaps not an answer to the question you asked, but this is a
>discussion group and not a paid-for support line.

Discussion groups involve questions. Perhaps you don't quite understand how
usenet works.

blt_8r...@4rbys.gov.uk

unread,
Mar 5, 2019, 11:20:20 AM3/5/19
to
On Tue, 5 Mar 2019 07:31:22 -0800 (PST)
james...@alumni.caltech.edu wrote:
>On Monday, March 4, 2019 at 11:16:32 AM UTC-5, blt_x...@uif_e90m4cobh00lil.net
>wrote:
>> On Mon, 4 Mar 2019 05:11:47 -0800 (PST)
>> =?UTF-8?B?w5bDtiBUaWli?= <oot...@hot.ee> wrote:
>> >Yes, JavaScript. For code meant to run in web browser. Have you ever
>> >seen a web browser? Well Firefox (from version 22), Safari (from
>> >version 3.1), Edge (from version 13) fully support asm.js. Chrome (from
>> >version 36) and Opera (from version 15) support asm.js partially.
>>
>> Fascinating.
>>
>> >You are talking about particular compiler implementation (perhaps for
>> >particular platform) that generates .o files. Without mentioning those
>> >things the questions about object code generation make no sense.
>>
>> This is a C++ group, I have no idea why you're talking about javascript
>> and browsers. Are you drunk?
>
>This is a C++ group. I have no idea why you're talking about "the"
>generated object code. Are you drunk?

Compilers generate output. Apparently you don't think so.

>
>The answers to your questions about the generated object code will have
>different answers for different implementations of C++, because the C++
>standard only describes requirements on what the behavior should be - it
>says nothing about the details of how that behavior should be produced.
>Some implementations will not even generate any object code at all,
>which was why he brought up, as an extreme example, an implementation
>that generates javascript instead of object code.
>
>If you specify a particular implementation that you're talking about,
>your question would make more sense, though it would be better to ask
>your question in a forum specific to that implementation.
>
>If you can convert your question into one about the required behavior
>rather than the generated object code, then this would be the right
>newsgroup to ask it in.

Its becoming painfully obvious that this group is little more than a mix of
self regarding pedants and aspergers sufferers who fixate on irrelevant
terminology and ignore or miss the point either deliberately (the former) or
because they can't see it due to mental deficiencies (the latter).


Öö Tiib

unread,
Mar 5, 2019, 11:29:16 AM3/5/19
to
I already gave three points why your questions were confused and
nonsensical. No one does still know what you were trying actually
to ask if anything. My impression is that you were not asking but
specially trying to construct questions randomly composed of
C++ related terms in as nonsensical manner as only possible for
pretending to be idiotic.

> >your babble about "object code" are as meaningless as talking about
> >JavaScript without mentioning C++ Emscripten toolchain.
> >Stop pretending being idiot since that trait is not overly popular
> >anywhere.
>
> Or perhaps your English isn't as good as you think it is.

My English is good enough to communicate; that does not matter
when instead of communication you want to pretend being an
idiot.

james...@alumni.caltech.edu

unread,
Mar 5, 2019, 11:35:50 AM3/5/19
to
On Tuesday, March 5, 2019 at 11:08:36 AM UTC-5, blt_t6t...@qrzz1g0rb.ac.uk wrote:
> On Tue, 5 Mar 2019 12:16:30 +0100
> David Brown <david...@hesbynett.no> wrote:
...
> >You made a somewhat confused post about what object code compilers
> >generate for different C++ source code. Öö was trying to point out to
> >you that this is not something defined by the language. The language
> >does not even require a compiler to generate object code - he gave the
> >example of generating asm.js output.
>
> And that is relevant to my question how exactly? I said object code, I could
> easily have just said output.

That doesn't help, because it still doesn't have a unique answer, just
different answers on different implementations of C++. All you've done
by changing it to "output" is to widen the range of possibilities.

> >The wide variety of C++ compilers, options, flags, target chips,
> >non-native targets, etc., show how meaningless it is to ask "what do
> >compilers generate here".
>
> Oh ok. So any question regarding the output of a compiler is meaningless
> is it because there could be multiple output types?

No, it's only questions about the output of an unspecified compiler that
are meaningless. Questions about the output of a specific compiler can
be quite meaningful. Such questions are best asked in forums specific to
the compiler in question, which this isn't.

On the other hand, this is precisely the best forum for asking questions
about the behavior required by the C++ standard for the final program.
Can you convert your question into one about the behavior of your code?
I'd recommend re-writing it to include some constructs with observable
behavior, as that term is defined by the C++ standard, for instance by
inserting code that writes a message when the function is called.

...
> >questions, then read the answers. Maybe you'll learn something -
> >perhaps not an answer to the question you asked, but this is a
> >discussion group and not a paid-for support line.
>
> Discussion groups involve questions. Perhaps you don't quite understand how
> usenet works.

Discussions also routinely involve questions being answered in ways that
the questioner didn't anticipate, because the question wasn't meaningful
as asked.

james...@alumni.caltech.edu

unread,
Mar 5, 2019, 11:46:53 AM3/5/19
to
On Tuesday, March 5, 2019 at 11:20:20 AM UTC-5, blt_8r...@4rbys.gov.uk wrote:
> On Tue, 5 Mar 2019 07:31:22 -0800 (PST)
> james...@alumni.caltech.edu wrote:
> >On Monday, March 4, 2019 at 11:16:32 AM UTC-5, blt_x...@uif_e90m4cobh00lil.net
> >wrote:
> >> On Mon, 4 Mar 2019 05:11:47 -0800 (PST)
> >> =?UTF-8?B?w5bDtiBUaWli?= <oot...@hot.ee> wrote:
> >> >Yes, JavaScript. For code meant to run in web browser. Have you ever
> >> >seen a web browser? Well Firefox (from version 22), Safari (from
> >> >version 3.1), Edge (from version 13) fully support asm.js. Chrome (from
> >> >version 36) and Opera (from version 15) support asm.js partially.
> >>
> >> Fascinating.
> >>
> >> >You are talking about particular compiler implementation (perhaps for
> >> >particular platform) that generates .o files. Without mentioning those
> >> >things the questions about object code generation make no sense.
> >>
> >> This is a C++ group, I have no idea why you're talking about javascript
> >> and browsers. Are you drunk?
> >
> >This is a C++ group. I have no idea why you're talking about "the"
> >generated object code. Are you drunk?
>
> Compilers generate output. Apparently you don't think so.

I said nothing to suggest that. You, on the other hand, seem to believe
that C++ implementations always produce object code, and never generate
javascript, whereas a counter-example to that belief has already been
cited.

...
> Its becoming painfully obvious that this group is little more than a mix of
> self regarding pedants and aspergers sufferers who fixate on irrelevant
> terminology and ignore or miss the point

We "miss the point" because the question as asked was pointless. You're
not going to like answers that point that out, but if you were to pay
proper attention to those answers, rather than just dismissing them, you
might figure out how to reword your question so it does have a point.

blt_1d...@_44t2ae_.co.uk

unread,
Mar 5, 2019, 12:14:17 PM3/5/19
to
On Tue, 5 Mar 2019 08:29:07 -0800 (PST)
=?UTF-8?B?w5bDtiBUaWli?= <oot...@hot.ee> wrote:
>On Tuesday, 5 March 2019 18:06:27 UTC+2, blt_a...@3depem2rtoo4k9_kbk9ri.gov
>wrote:
>> I'm sorry, I should have realised that you don't actually have an answer
>> to my question but being desperate for something to say you decided to be
>> a pathetic pedant about the meaning of "object code" which was obviously
>> confusing you.
>
>I already gave three points why your questions were confused and
>nonsensical. No one does still know what you were trying actually
>to ask if anything. My impression is that you were not asking but

Well some do since they answered. The question was simple - what is the
difference between a reference and a move type reference in the case of
constructors but you were obviously too thick to understand that.

>> >your babble about "object code" are as meaningless as talking about
>> >JavaScript without mentioning C++ Emscripten toolchain.
>> >Stop pretending being idiot since that trait is not overly popular
>> >anywhere.
>>
>> Or perhaps your English isn't as good as you think it is.
>
>My English is good enough to communicate; that does not matter
>when instead of communication you want to pretend being an
>idiot.

Its "pretend to be an idiot". You use the infinitive of "be", not the present
continuous in that construct.


blt_4h9...@ai8rhnz2.com

unread,
Mar 5, 2019, 12:16:23 PM3/5/19
to
On Tue, 5 Mar 2019 08:35:41 -0800 (PST)
james...@alumni.caltech.edu wrote:
>That doesn't help, because it still doesn't have a unique answer, just
>different answers on different implementations of C++. All you've done
>by changing it to "output" is to widen the range of possibilities.

So C++ compilers behave differently with the same source code? So perhaps you
think when presented with "i++" they'll actually do a subtract? Or if I'd
asked what is the difference between ++ and -- in the output you'd have
quibbled about the meaning of output then too?

>No, it's only questions about the output of an unspecified compiler that

[Drivel snipped].

I think we've established you didn't understand the question. Don't
embarrass yourself any further.


blt_3c...@iword.net

unread,
Mar 5, 2019, 12:19:31 PM3/5/19
to
On Tue, 5 Mar 2019 08:46:44 -0800 (PST)
james...@alumni.caltech.edu wrote:
>On Tuesday, March 5, 2019 at 11:20:20 AM UTC-5, blt_8r...@4rbys.gov.uk wrote:
>> >This is a C++ group. I have no idea why you're talking about "the"
>> >generated object code. Are you drunk?
>>
>> Compilers generate output. Apparently you don't think so.
>
>I said nothing to suggest that. You, on the other hand, seem to believe
>that C++ implementations always produce object code, and never generate
>javascript, whereas a counter-example to that belief has already been
>cited.

I don't fucking care what the compiler generates as output, it could be a
shakespear sonnet or the the Marseillaise. I care about whether there would be
any *DIFFERENCE* in output given 2 different types of of input. Sorry if this
is a complex concept for you and the others to grasp. Perhaps go back to
programming Hello World in BASIC.

>> Its becoming painfully obvious that this group is little more than a mix of
>> self regarding pedants and aspergers sufferers who fixate on irrelevant
>> terminology and ignore or miss the point
>
>We "miss the point" because the question as asked was pointless. You're

No, you missed the point because you're stupid.

james...@alumni.caltech.edu

unread,
Mar 5, 2019, 12:35:56 PM3/5/19
to
On Tuesday, March 5, 2019 at 12:19:31 PM UTC-5, blt_3c...@iword.net wrote:
> On Tue, 5 Mar 2019 08:46:44 -0800 (PST)
> james...@alumni.caltech.edu wrote:
> >On Tuesday, March 5, 2019 at 11:20:20 AM UTC-5, blt_8r...@4rbys.gov.uk wrote:
> >> >This is a C++ group. I have no idea why you're talking about "the"
> >> >generated object code. Are you drunk?
> >>
> >> Compilers generate output. Apparently you don't think so.
> >
> >I said nothing to suggest that. You, on the other hand, seem to believe
> >that C++ implementations always produce object code, and never generate
> >javascript, whereas a counter-example to that belief has already been
> >cited.
>
> I don't fucking care what the compiler generates as output, it could be a
> shakespear sonnet or the the Marseillaise. I care about whether there would be
> any *DIFFERENCE* in output given 2 different types of of input.

A better way to express that is to say that you do care about the output - specifically, you care about whether the output would be different. Unfortunately, you won't take "it depends" as the answer, because that's the only correct answer to such a vague question.

> ... Sorry if this
> is a complex concept for you and the others to grasp. Perhaps go back to
> programming Hello World in BASIC.

It's not too complex a question to answer, it's too vague to answer.
It's like asking "Would it make any difference if I turned a container
upside down?" - without telling us anything about what kind of container
it is and what it contains, if anything.

Keep in mind that one of the two options you're asking about is ill-
formed code, and both versions would be required to have no observable
behavior, even if that weren't a problem. There's serious limits as to
how useful the answer to such a question about such code could ever be.

Chris Vine

unread,
Mar 5, 2019, 12:47:34 PM3/5/19
to
I can imagine by your postings that this kind of thing happens to you
quite often. How difficult for you.

Daniel

unread,
Mar 5, 2019, 1:12:45 PM3/5/19
to
You need an apostrophe here, "it's"

> "pretend to be an idiot". You use the infinitive of "be", not the present > continuous in that construct.

I think the original wording is okay, the present continuous "being an
idiot" does require a subject, but the subject being understood to be "you",
it would seem pedantic to write "you want to pretend you are being an
idiot."

Best regards,
Daniel

james...@alumni.caltech.edu

unread,
Mar 5, 2019, 1:27:28 PM3/5/19
to
On Tuesday, March 5, 2019 at 12:16:23 PM UTC-5, blt_4h9...@ai8rhnz2.com wrote:
> On Tue, 5 Mar 2019 08:35:41 -0800 (PST)
> james...@alumni.caltech.edu wrote:
> >That doesn't help, because it still doesn't have a unique answer, just
> >different answers on different implementations of C++. All you've done
> >by changing it to "output" is to widen the range of possibilities.
>
> So C++ compilers behave differently with the same source code?

You find that surprising? Why do you think the standard defines
"undefined behavior: behavior for which this document imposes no
requirements" (3.27) and "unspecified behavior: behavior, for a well-
formed program construct and correct data, that depends on the
implementation" (3.28).

The first version of your code is ill-formed, so an implementation need
not even compile it, it's only required to issue a diagnostic. If it
chooses to compile it anyway after issuing the diagnostic, and if you
choose to execute the resulting program despite the diagnostic, then the
behavior is undefined. In terms of object code, that means that anything
is permitted, including no object code at all.

You asked about the generated object code - that's unspecified, being
outside the scope of the C++ standard. The C++ standard only defines the
observable behavior of the resulting program. If there's two or more
ways to generate object code which produce the same observable
behavior, all such ways are equally permitted, and different
implementations can and do make different choices. Given the way that
the C++ standard defines observable behavior, there's always infinitely
many differrent ways to produce the same observable behavior, even if
you target only one particular piece of hardware.

If you ignore the fact that the first function is ill formed, neither
function has a function body that produces any observable behavior. In
terms of object code, that means that any object code that has no
observable behavior is permitted. In particular, the generation of no
object code at all is permitted, but if any object code is generated, it
might be different object code on different implementations.

> ... So perhaps you
> think when presented with "i++" they'll actually do a subtract?

They very well, might, if the code has undefined behavior. That could
happen, for instance, if i starts out with the maximum possible value of
a signed integer type. It could also happen if an operator overload is
invoked, depending upon how that overload is defined. It could also
happen if it's ambiguous as to which operator overload should be
invoked. The behavior of the entire prdogram, including the "i++", could
also be undefined due to a defect in some completely unrelated piece of
code.

Also, i++ might actually be required to perform a subtraction. That will
be the case if i has an unsigned integer type and starts out containing
the maximum value representable in that type. The standard defines the
resulting behavior in terms of computing the mathematical result of
adding 1 to that value, and then (in the general case) adding or
subtracting one more than the maximum value that can be represented in
that type, as many times as needed to bring the result into the range
that can be represented. In this particular case, that means exactly one
such subtraction.

> ... Or if I'd
> asked what is the difference between ++ and -- in the output you'd have
> quibbled about the meaning of output then too?

A question about the output object code for "++" and "--", without
specifying a particular implementation of C++, is just as vague as the
same question about any other code construct. Object code is outside the
scope of the C++ standard, and different implementations can produce
vastly different object code, particularly if generating for different
targets. However, it's perfectly feasible to ask a meaningful question
about the difference in behavior of ++ and --, so long as the context is
one where both constructs have behavior that is defined.

David Brown

unread,
Mar 5, 2019, 3:59:01 PM3/5/19
to
On 05/03/2019 18:16, blt_4h9...@ai8rhnz2.com wrote:
> On Tue, 5 Mar 2019 08:35:41 -0800 (PST)
> james...@alumni.caltech.edu wrote:
>> That doesn't help, because it still doesn't have a unique answer, just
>> different answers on different implementations of C++. All you've done
>> by changing it to "output" is to widen the range of possibilities.
>
> So C++ compilers behave differently with the same source code?

Yes, of course - in all sorts of ways.

> So perhaps you
> think when presented with "i++" they'll actually do a subtract?

I know targets for which that is /exactly/ the code that will be
generated. I have worked with processors with no "inc" or "add
immediate" instructions, but which have a "subtract immediate". "i++"
would be implemented as "subtract immediate -1".

Your attempts at spiteful sarcasm merely enhance the image we are
getting of you being an ill-mannered and unpleasant character, who hides
his ignorance behind insults.

> Or if I'd
> asked what is the difference between ++ and -- in the output you'd have
> quibbled about the meaning of output then too?
>
>> No, it's only questions about the output of an unspecified compiler that
>
> [Drivel snipped].
>
> I think we've established you didn't understand the question. Don't
> embarrass yourself any further.
>

Is your grand plan to insult and alienate everyone in the group who is
knowledgeable and experienced in C++, and patient and helpful enough to
try to answer your questions or to try to help you ask better questions?
I would strongly recommend staying on James' good side - there are few
who have his combination of strong technical knowledge, enviable
teaching skills, and the time and patience to give help freely.

Manfred

unread,
Mar 5, 2019, 9:07:23 PM3/5/19
to
Yes, the example ctor from the OP had const &&, which is incorrect as
others have pointed out, but his/her question was:

> Regarding the 2011 move constructors - do compilers actually generate
> different code for the given class compared to if it had a standard copy
> constructor, or are the && move semantics simply a way of indicating to any
> maintenance coders that this constructor will do a move not a copy?

So about the "&& move semantics" that he/she was asking about, the
answer is:
1) The correct way to code move semantics is Moveable&& (non-const),
which is obvious since a move can typically modify the source.
2) No, it is not only syntactic sugar to inform future maintainers.


>
> R'
>

bitrex

unread,
Mar 5, 2019, 11:40:50 PM3/5/19
to
There isn't any sane application for a const rvalue reference that I
know of. I'm ready to be corrected...:)

Bonita Montero

unread,
Mar 6, 2019, 2:34:45 AM3/6/19
to
> 3) Third thing is that C++ compilers !typically! generate no code
> for (and even optimize out the calls of) functions that do nothing.

If you have an external function that does nothing there will be
code generated for it. How should a compiler just including the
prototype know that the body of a function in another module is
empty?

Paavo Helde

unread,
Mar 6, 2019, 2:58:15 AM3/6/19
to
The techniques are called Whole Program Optimization and Link Time Code
Generation, supported by all major C++ implementations.

blt_7...@dphu.org

unread,
Mar 6, 2019, 3:46:04 AM3/6/19
to
On Tue, 5 Mar 2019 21:58:51 +0100
David Brown <david...@hesbynett.no> wrote:
>On 05/03/2019 18:16, blt_4h9...@ai8rhnz2.com wrote:
>> On Tue, 5 Mar 2019 08:35:41 -0800 (PST)
>> james...@alumni.caltech.edu wrote:
>>> That doesn't help, because it still doesn't have a unique answer, just
>>> different answers on different implementations of C++. All you've done
>>> by changing it to "output" is to widen the range of possibilities.
>>
>> So C++ compilers behave differently with the same source code?
>
>Yes, of course - in all sorts of ways.
>
>> So perhaps you
>> think when presented with "i++" they'll actually do a subtract?
>
>I know targets for which that is /exactly/ the code that will be
>generated. I have worked with processors with no "inc" or "add
>immediate" instructions, but which have a "subtract immediate". "i++"
>would be implemented as "subtract immediate -1".

So that compiler would return the result of "i=2;i++" as i = 1?

>Your attempts at spiteful sarcasm merely enhance the image we are
>getting of you being an ill-mannered and unpleasant character, who hides
>his ignorance behind insults.

I very politely asked a sensible question and in response I get called
ignorant and a fool. Yet somehow I'm being spiteful for responsing in kind?
On your bike sunshine.

>> I think we've established you didn't understand the question. Don't
>> embarrass yourself any further.
>>
>
>Is your grand plan to insult and alienate everyone in the group who is
>knowledgeable and experienced in C++, and patient and helpful enough to
>try to answer your questions or to try to help you ask better questions?

I can just post under a completely different handle and you'd never know
so what do I care.

> I would strongly recommend staying on James' good side - there are few
>who have his combination of strong technical knowledge, enviable
>teaching skills, and the time and patience to give help freely.

I don't suck up to people if they're patronising.


Öö Tiib

unread,
Mar 6, 2019, 4:04:53 AM3/6/19
to
The usage of rvalue reference to const as function (does not matter if
constructor) parameter is for overload resolution at call site. Basically
it does not let other overload with reference to const parameter to bind
to rvalue arguments.
Standard actually brings example of usage. If to explicitly delete the
overload with rvalue reference to const parameter (= delete;) then
attempt to call these with rvalue will result with compile error. That
might help to avoid dangling const references to temporaries.

Ian Collins

unread,
Mar 6, 2019, 4:29:32 AM3/6/19
to
On 06/03/2019 09:58, David Brown wrote:
>
> Is your grand plan to insult and alienate everyone in the group who is
> knowledgeable and experienced in C++, and patient and helpful enough to
> try to answer your questions or to try to help you ask better questions?

Isn't that pretty obvious by now?

--
Ian.

Paavo Helde

unread,
Mar 6, 2019, 4:50:53 AM3/6/19
to
On 6.03.2019 10:45, blt_7...@dphu.org wrote:

> I very politely asked a sensible question and in response I get called
> ignorant and a fool. Yet somehow I'm being spiteful for responsing in kind?
> On your bike sunshine.

Nope, you were only called ignorant and fool after you refused to accept
that your original question did not make much sense, and started to
attack responders instead of trying to clarify your question.

David Brown

unread,
Mar 6, 2019, 5:09:00 AM3/6/19
to
On 06/03/2019 09:45, blt_7...@dphu.org wrote:
> On Tue, 5 Mar 2019 21:58:51 +0100
> David Brown <david...@hesbynett.no> wrote:
>> On 05/03/2019 18:16, blt_4h9...@ai8rhnz2.com wrote:
>>> On Tue, 5 Mar 2019 08:35:41 -0800 (PST)
>>> james...@alumni.caltech.edu wrote:
>>>> That doesn't help, because it still doesn't have a unique answer, just
>>>> different answers on different implementations of C++. All you've done
>>>> by changing it to "output" is to widen the range of possibilities.
>>>
>>> So C++ compilers behave differently with the same source code?
>>
>> Yes, of course - in all sorts of ways.
>>
>>> So perhaps you
>>> think when presented with "i++" they'll actually do a subtract?
>>
>> I know targets for which that is /exactly/ the code that will be
>> generated. I have worked with processors with no "inc" or "add
>> immediate" instructions, but which have a "subtract immediate". "i++"
>> would be implemented as "subtract immediate -1".
>
> So that compiler would return the result of "i=2;i++" as i = 1?
>

No. Try again, but this time read carefully and /think/. What does it
mean to subtract -1 ?

>> Your attempts at spiteful sarcasm merely enhance the image we are
>> getting of you being an ill-mannered and unpleasant character, who hides
>> his ignorance behind insults.
>
> I very politely asked a sensible question and in response I get called
> ignorant and a fool. Yet somehow I'm being spiteful for responsing in kind?
> On your bike sunshine.

No, you asked a meaningless question. That in itself is not a bad thing
- often a poster's question needs to be refined in order to help them.
And often the process of fixing the question gives clearer
understanding, and that is what helps the OP most. Once you have
figured out the right question, you are halfway to the answer.

You have been called a variety of things as a result of your posts after
that - your responses to people trying to help you. I didn't call you
spiteful for your response to people calling you an ignorant fool - I
called you spiteful for because you called others ignorant fools for
daring to suggest that your question was bad, and that it showed you
misunderstand a lot of things. There is nothing wrong with being
ignorant - that is curable by listening to people that are more
knowledgeable. There /is/ something wrong with being a fool, and that
is harder to deal with.

You have shown that you don't understand how compilers work, you don't
understand the distinction between a compiler and the language, you
don't understand the breadth of possible implementations of the
language, you don't understand move constructors and you don't
understand rvalue references.

/None/ of that is a problem. These are all things that we can help you
with - and have tried to help you with.

The problem is that you /think/ you understand these things, and you
treat anyone who questions your understanding as fools to be insulted.

>
>>> I think we've established you didn't understand the question. Don't
>>> embarrass yourself any further.
>>>
>>
>> Is your grand plan to insult and alienate everyone in the group who is
>> knowledgeable and experienced in C++, and patient and helpful enough to
>> try to answer your questions or to try to help you ask better questions?
>
> I can just post under a completely different handle and you'd never know
> so what do I care.

Feel free to start again with a new posting address (pick /one/, and
stick to it) and a new attitude. I would be happy with that. We
welcome new people with new questions and a willingness to learn.

But if you post in the same style, you will be treated in the same way.

>
>> I would strongly recommend staying on James' good side - there are few
>> who have his combination of strong technical knowledge, enviable
>> teaching skills, and the time and patience to give help freely.
>
> I don't suck up to people if they're patronising.
>

No one asks you to "suck up" to anyone - we ask for common decency,
politeness and respect.

blt_r8...@slz3z1ayz.net

unread,
Mar 6, 2019, 7:15:37 AM3/6/19
to
It made perfect sense for anyone with a working brain. However it seems this
group isn't about answering queries, but rather on posters getting one over on
each other. Don't worry, I've asked the exact same question on a different
forum now and instead of pretend ignorance and pedancy I actually got a sensible
reply.

blt_...@mr3qwrpz7zr0ss9hctqd2nd.com

unread,
Mar 6, 2019, 7:19:55 AM3/6/19
to
On Wed, 6 Mar 2019 11:08:48 +0100
David Brown <david...@hesbynett.no> wrote:
>On 06/03/2019 09:45, blt_7...@dphu.org wrote:
>> On Tue, 5 Mar 2019 21:58:51 +0100
>> David Brown <david...@hesbynett.no> wrote:
>>> On 05/03/2019 18:16, blt_4h9...@ai8rhnz2.com wrote:
>>>> On Tue, 5 Mar 2019 08:35:41 -0800 (PST)
>>>> james...@alumni.caltech.edu wrote:
>>>>> That doesn't help, because it still doesn't have a unique answer, just
>>>>> different answers on different implementations of C++. All you've done
>>>>> by changing it to "output" is to widen the range of possibilities.
>>>>
>>>> So C++ compilers behave differently with the same source code?
>>>
>>> Yes, of course - in all sorts of ways.
>>>
>>>> So perhaps you
>>>> think when presented with "i++" they'll actually do a subtract?
>>>
>>> I know targets for which that is /exactly/ the code that will be
>>> generated. I have worked with processors with no "inc" or "add
>>> immediate" instructions, but which have a "subtract immediate". "i++"
>>> would be implemented as "subtract immediate -1".
>>
>> So that compiler would return the result of "i=2;i++" as i = 1?
>>
>
>No. Try again, but this time read carefully and /think/. What does it
>mean to subtract -1 ?

Ooo, I've no idea, thats such complex maths!

Never mind Rainman, clearly you don't get sarcasm either as well as not
understanding a simple original question.

Its fairly clear this group is a waste of time.

Bonita Montero

unread,
Mar 6, 2019, 7:24:37 AM3/6/19
to
>> If you have an external function that does nothing there will be
>> code generated for it. How should a compiler just including the
>> prototype know that the body of a function in another module is
>> empty?

> The techniques are called Whole Program Optimization and Link Time
> Code Generation, supported by all major C++ implementations.

Ok, then they could reanimate the export-keyword. ;-)

Paavo Helde

unread,
Mar 6, 2019, 7:40:23 AM3/6/19
to
Good for you, as nobody here still has any clue what you actually wanted
to ask.

Was it if the compiler logically does s/&&/&/ before starting to compile
C++ code? Or was it if the compiler emits the same assembler opcode for
passing either an lvalue or an rvalue reference into the function?

Nobody knows, and answers to those questions are different.


David Brown

unread,
Mar 6, 2019, 8:16:07 AM3/6/19
to
You can't cover your misunderstanding by retroactively claiming it was
sarcasm. You failed to understand what I wrote because you were far too
busy trying to find new smart-ass comments to make. The correct
response would have been an admission of the error - not compounding
your rudeness.

> Its fairly clear this group is a waste of time.
>

No one is asking you to post here.

James Kuyper

unread,
Mar 6, 2019, 8:24:27 AM3/6/19
to
On 3/6/19 03:45, blt_7...@dphu.org wrote:
> On Tue, 5 Mar 2019 21:58:51 +0100
> David Brown <david...@hesbynett.no> wrote:
>> On 05/03/2019 18:16, blt_4h9...@ai8rhnz2.com wrote:
...
>>> So perhaps you
>>> think when presented with "i++" they'll actually do a subtract?
>>
>> I know targets for which that is /exactly/ the code that will be
>> generated. I have worked with processors with no "inc" or "add
>> immediate" instructions, but which have a "subtract immediate". "i++"
>> would be implemented as "subtract immediate -1".
>
> So that compiler would return the result of "i=2;i++" as i = 1?

You get 1 when you subtract -1 from 2? I recommend asking for a refund
for the cost of your elementary math education. In the unlikely event
that the refund is approved, count it out carefully - I would not
recommend relying upon the elementary arithmetic skills of either you or
your teacher.

>> Your attempts at spiteful sarcasm merely enhance the image we are
>> getting of you being an ill-mannered and unpleasant character, who hides
>> his ignorance behind insults.
>
> I very politely asked a sensible question

You asked a question about the difference between two functions, neither
of which actually does anything, and one of which was ill-formed. You
consider that a sensible question?

A similarly posed question about the difference in the behavior (and not
in the generated object code) between & and && in a parameter
declaration when both are legal, and the functions involved actually do
something, could be sensible. Yours wasn't.

I will fully grant you that your initial question was polite. Your
response to people pointing out the problems with your question was not.

...
>> Is your grand plan to insult and alienate everyone in the group who is
>> knowledgeable and experienced in C++, and patient and helpful enough to
>> try to answer your questions or to try to help you ask better questions?
>
> I can just post under a completely different handle and you'd never know
> so what do I care.

You'll probably be surprised by the results if you try it. It's not
your user name, but your personality, as revealed by your messages, that
we find bothersome. I've seen other people like you use as many as five
radically different user names, but it was trivial to identify them by
their conversational style. I've seldom explicitly mentioned that I
noticed, but I have carried on a conversation with the same person who
used multiple aliases in the same thread, treating him just the same as
if he'd used the same name throughout the conversation. I wonder if he
noticed that?

>> I would strongly recommend staying on James' good side - there are few
>> who have his combination of strong technical knowledge, enviable
>> teaching skills, and the time and patience to give help freely.
>
> I don't suck up to people if they're patronising.

I have no desire to be "sucked up to". Reading my responses carefully
and responding to them intelligently is all that I would want of you.

If you think that 2 - -1 == 1, then you've got a long way to go before
you can legitimately object to a patronizing tone.

Öö Tiib

unread,
Mar 6, 2019, 9:27:27 AM3/6/19
to
On Tuesday, 5 March 2019 19:14:17 UTC+2, blt_1d...@_44t2ae_.co.uk wrote:
> On Tue, 5 Mar 2019 08:29:07 -0800 (PST)
> =?UTF-8?B?w5bDtiBUaWli?= <oot...@hot.ee> wrote:
> >On Tuesday, 5 March 2019 18:06:27 UTC+2, blt_a...@3depem2rtoo4k9_kbk9ri.gov
> >wrote:
> >> I'm sorry, I should have realised that you don't actually have an answer
> >> to my question but being desperate for something to say you decided to be
> >> a pathetic pedant about the meaning of "object code" which was obviously
> >> confusing you.
> >
> >I already gave three points why your questions were confused and
> >nonsensical. No one does still know what you were trying actually
> >to ask if anything. My impression is that you were not asking but
>
> Well some do since they answered.

Provide a link unless the claim is some of your self-irony again.

> The question was simple - what is the
> difference between a reference and a move type reference in the case of
> constructors but you were obviously too thick to understand that.

Since you never asked anything anywhere resembling that. The difference
between constructors with different kinds of parameters is with what kinds
of arguments these constructors can be called.

blt...@2s6u1wctmk9lsbz.gov.uk

unread,
Mar 7, 2019, 3:52:55 AM3/7/19
to
On Wed, 06 Mar 2019 14:40:12 +0200
Paavo Helde <myfir...@osa.pri.ee> wrote:
>On 6.03.2019 14:15, blt_r8...@slz3z1ayz.net wrote:
>> On Wed, 06 Mar 2019 11:50:40 +0200
>> Paavo Helde <myfir...@osa.pri.ee> wrote:
>>> On 6.03.2019 10:45, blt_7...@dphu.org wrote:
>>>
>>>> I very politely asked a sensible question and in response I get called
>>>> ignorant and a fool. Yet somehow I'm being spiteful for responsing in kind?
>
>>>> On your bike sunshine.
>>>
>>> Nope, you were only called ignorant and fool after you refused to accept
>>> that your original question did not make much sense, and started to
>>> attack responders instead of trying to clarify your question.
>>
>> It made perfect sense for anyone with a working brain. However it seems this
>> group isn't about answering queries, but rather on posters getting one over
>on
>> each other. Don't worry, I've asked the exact same question on a different
>> forum now and instead of pretend ignorance and pedancy I actually got a
>sensible
>> reply.
>
>Good for you, as nobody here still has any clue what you actually wanted
>to ask.

I've stated 3 the question 3 times. I'd suggest you improve your English
comprehension before you accuse others of not making sense.

>Was it if the compiler logically does s/&&/&/ before starting to compile
>C++ code?

Oh congratulations, you finally figure out part of it. It only took 4 days.
Well done, your mummy must be proud of you.

blt_...@ov9jxwu4h9kk.gov

unread,
Mar 7, 2019, 3:54:31 AM3/7/19
to
On Wed, 6 Mar 2019 14:15:57 +0100
David Brown <david...@hesbynett.no> wrote:
>On 06/03/2019 13:19, blt_...@mr3qwrpz7zr0ss9hctqd2nd.com wrote:
>> Ooo, I've no idea, thats such complex maths!
>>
>> Never mind Rainman, clearly you don't get sarcasm either as well as not
>> understanding a simple original question.
>>
>
>You can't cover your misunderstanding by retroactively claiming it was
>sarcasm. You failed to understand what I wrote because you were far too

Given that anyone who couldn't understand - -1 would have little chance
working in programming it would be pretty obvious to anyone who's not
aspergers that it was sarcasm. Don't try and cover your inability to understand
emotion or read between the lines by self important bluster.

Paavo Helde

unread,
Mar 7, 2019, 4:06:13 AM3/7/19
to
On 7.03.2019 10:52, blt...@2s6u1wctmk9lsbz.gov.uk wrote:
> On Wed, 06 Mar 2019 14:40:12 +0200
> Paavo Helde <myfir...@osa.pri.ee> wrote:
>> On 6.03.2019 14:15, blt_r8...@slz3z1ayz.net wrote:
>>>>> I very politely asked a sensible question and in response I get called
>>>>> ignorant and a fool. Yet somehow I'm being spiteful for responsing in kind?
>
>> Was it if the compiler logically does s/&&/&/ before starting to compile
>> C++ code?
>
> Oh congratulations, you finally figure out part of it. It only took 4 days.

I suspected this already before, but I gave you a benefit of doubt.

David Brown

unread,
Mar 7, 2019, 4:51:04 AM3/7/19
to
Do you really expect anyone to believe you? Sure, you know what
subtracting -1 means. But you didn't read that, you were far too
interested in making smart-ass comments and insults to take the time to
read.

David Brown

unread,
Mar 7, 2019, 4:53:47 AM3/7/19
to
On 07/03/2019 09:52, blt...@2s6u1wctmk9lsbz.gov.uk wrote:

> I've stated 3 the question 3 times. I'd suggest you improve your English
> comprehension before you accuse others of not making sense.
>
Keep your xenophobia insults to yourself. Paavo (and Öö) write English
better than many native speakers - and you make a fair few mistakes
yourself.

The problem in understanding your question was with the writer, not the
readers - the fact that lots of people had trouble figuring out what you
meant should have been a clue.

blt_...@4t0h9a2.gov

unread,
Mar 7, 2019, 5:31:37 AM3/7/19
to
On Thu, 7 Mar 2019 10:50:53 +0100
David Brown <david...@hesbynett.no> wrote:
>On 07/03/2019 09:54, blt_...@ov9jxwu4h9kk.gov wrote:
>> On Wed, 6 Mar 2019 14:15:57 +0100
>> David Brown <david...@hesbynett.no> wrote:
>>> On 06/03/2019 13:19, blt_...@mr3qwrpz7zr0ss9hctqd2nd.com wrote:
>>>> Ooo, I've no idea, thats such complex maths!
>>>>
>>>> Never mind Rainman, clearly you don't get sarcasm either as well as not
>>>> understanding a simple original question.
>>>>
>>>
>>> You can't cover your misunderstanding by retroactively claiming it was
>>> sarcasm. You failed to understand what I wrote because you were far too
>>
>> Given that anyone who couldn't understand - -1 would have little chance
>> working in programming it would be pretty obvious to anyone who's not
>> aspergers that it was sarcasm. Don't try and cover your inability to
>understand
>> emotion or read between the lines by self important bluster.
>>
>
>Do you really expect anyone to believe you? Sure, you know what

Believe what you like. Your ridiculous attempt to get yourself out of a corner
you painted yourself into is quite amusing however :)

>Keep your xenophobia insults to yourself.

We'll note down xenophobia as another subject you don't have a clue about
shall we.

Sam

unread,
Mar 7, 2019, 7:08:04 AM3/7/19
to
blt_...@4t0h9a2.gov writes:

> Believe what you like. Your ridiculous attempt to get yourself out of a
> corner
> you painted yourself into is quite amusing however :)

I just read that there's a Monty Python remake that's in the works.

You should really audition for the role of the Black Knight. You'd be a
natural.

> >Keep your xenophobia insults to yourself.
>
> We'll note down xenophobia as another subject you don't have a clue about
> shall we.

Indeed. You're the undisputed xenophobic champion of 2019. Nobody knows more
about xenophobia than you.


James Kuyper

unread,
Mar 7, 2019, 7:56:00 AM3/7/19
to
The fundamental problem with that explanation is that your comment makes
no sense as sarcasm - whereas it's entirely plausible that, in your
haste to insult anyone and everyone who disagrees with you, you missed
the minus sign. You can claim otherwise. You might even be telling the
truth - but if it is true, you're out of luck, because this particular
truth is too implausible in this context to be believed.

Tim Rentsch

unread,
Mar 11, 2019, 1:52:13 PM3/11/19
to
"Alf P. Steinbach" <alf.p.stein...@gmail.com> writes:

> C++17 has guaranteed copy construction elision, where earlier
> standards just /permitted/ it.
>
> Among other things this lets a function return a value of a
> type that can't be copied or moved.

I am still something of a novice with respect to copy elision.
Can you give an example of a function definition and a call
to the function where the return type cannot be moved or
copied but the call still works because of copy elision?

> Unfortunately the wording seems to almost be intentionally
> obfuscated, it has to do with "materialization" of rvalues. I
> can't say I entirely understand it. But then, that's because I
> refuse to use time on it. :)

Can you say how materialization complicates understanding copy
elision? Looking at the C++ standard, AFAICS copy elision and
temporary materialization don't interact in any significant way.

Tim Rentsch

unread,
Mar 11, 2019, 1:54:09 PM3/11/19
to
Paavo Helde <myfir...@osa.pri.ee> writes:

[...]

> See
> e.g. http://thbecker.net/articles/rvalue_references/section_01.html
> for more explanations.

I found this article to be an excellent tutorial. Thank you
for posting this.

Alf P. Steinbach

unread,
Mar 11, 2019, 2:14:51 PM3/11/19
to
On 11.03.2019 18:51, Tim Rentsch wrote:
> "Alf P. Steinbach" <alf.p.stein...@gmail.com> writes:
>
>> C++17 has guaranteed copy construction elision, where earlier
>> standards just /permitted/ it.
>>
>> Among other things this lets a function return a value of a
>> type that can't be copied or moved.
>
> I am still something of a novice with respect to copy elision.
> Can you give an example of a function definition and a call
> to the function where the return type cannot be moved or
> copied but the call still works because of copy elision?

-----------------------------------------------------------------------
struct Result
{
int m_x;

explicit Result( const int x ): m_x( x ) {}

Result( const Result& ) = delete;
Result( Result&& ) = delete;
};

auto foo() -> Result { return Result( 42 ); }

#include <stdlib.h> // EXIT_...
auto main()
-> int
{ return foo().m_x == 42? EXIT_SUCCESS : EXIT_FAILURE; }
-----------------------------------------------------------------------

Compiling with MinGW g++ 8.2.0:


[H:\forums\clc++\041 copy elision]
> g++ main.cpp -std=c++14
main.cpp: In function 'Result foo()':
main.cpp:11:42: error: use of deleted function 'Result::Result(Result&&)'
auto foo() -> Result { return Result( 42 ); }
^
main.cpp:8:5: note: declared here
Result( Result&& ) = delete;
^~~~~~

[H:\forums\clc++\041 copy elision]
> g++ main.cpp -std=c++17

[H:\forums\clc++\041 copy elision]
> _


Compiling with Visual C++ 2017:


[H:\forums\clc++\041 copy elision]
> cl main.cpp /std:c++14
main.cpp
main.cpp(11): error C2280: 'Result::Result(Result &&)': attempting to
reference a deleted function
main.cpp(8): note: see declaration of 'Result::Result'
main.cpp(8): note: 'Result::Result(Result &&)': function was explicitly
deleted

[H:\forums\clc++\041 copy elision]
> cl main.cpp /std:c++17
main.cpp

[H:\forums\clc++\041 copy elision]
> _

>
>> Unfortunately the wording seems to almost be intentionally
>> obfuscated, it has to do with "materialization" of rvalues. I
>> can't say I entirely understand it. But then, that's because I
>> refuse to use time on it. :)
>
> Can you say how materialization complicates understanding copy
> elision? Looking at the C++ standard, AFAICS copy elision and
> temporary materialization don't interact in any significant way.

Oh, that's why I wrote that it seems almost intentionally obfuscated.

Sorry it's late in the day for me, otherwise I'd probably try to delve
into it.

It's VERY far from clear.


Cheers!,

- Alf

Fred.Zwarts

unread,
Mar 12, 2019, 7:17:58 AM3/12/19
to
"Tim Rentsch" schreef in bericht news:86tvg9s...@mailhub.linuxsc.com...
Indeed.

Tim Rentsch

unread,
Mar 17, 2019, 11:46:06 AM3/17/19
to
"Alf P. Steinbach" <alf.p.stein...@gmail.com> writes:

> On 11.03.2019 18:51, Tim Rentsch wrote:
>
>> "Alf P. Steinbach" <alf.p.stein...@gmail.com> writes:
>>
>>> C++17 has guaranteed copy construction elision, where earlier
>>> standards just /permitted/ it.
>>>
>>> Among other things this lets a function return a value of a
>>> type that can't be copied or moved.
>>
>> I am still something of a novice with respect to copy elision.
>> Can you give an example of a function definition and a call
>> to the function where the return type cannot be moved or
>> copied but the call still works because of copy elision?
>
> -----------------------------------------------------------------------
> struct Result
> {
> int m_x;
>
> explicit Result( const int x ): m_x( x ) {}
>
> Result( const Result& ) = delete;
> Result( Result&& ) = delete;
> };
>
> auto foo() -> Result { return Result( 42 ); }
>
> #include <stdlib.h> // EXIT_...
> auto main()
> -> int
> { return foo().m_x == 42? EXIT_SUCCESS : EXIT_FAILURE; }
>
> [..compilation results..]

This program is a helpful example. Thank you.

I have a followup question. Looking at the C++17 standard, it
appears to me that compiling this program is _allowed_ to use
copy elision but is not _required_ to do so. (I did not
investigate the question under C++14.) So it looks like the
program could compile just fine, or it could be given an error
for trying to use a deleted constructor. Does this match your
assessment? If it doesn't, can you identify passages in the
Standard that would impose requiring the copy elision?

>>> Unfortunately the wording seems to almost be intentionally
>>> obfuscated, it has to do with "materialization" of rvalues. I
>>> can't say I entirely understand it. But then, that's because I
>>> refuse to use time on it. :)
>>
>> Can you say how materialization complicates understanding copy
>> elision? Looking at the C++ standard, AFAICS copy elision and
>> temporary materialization don't interact in any significant way.
>
> Oh, that's why I wrote that it seems almost intentionally obfuscated.
>
> Sorry it's late in the day for me, otherwise I'd probably try to delve
> into it.
>
> It's VERY far from clear.

I have looked at this question again, and in a bit more detail.
It still looks like temporary materialization doesn't interact
with copy elision, except that it might change a candidate for
copy elision from being one that is required to one that is
allowed but not required. If you do dig into this question again
I would be interested to hear what you find out.

Alf P. Steinbach

unread,
Mar 17, 2019, 12:21:26 PM3/17/19
to
I think you'd better check Stack Overflow for an answer about how the
wording works. It works to guarantee, and it's been discussed there. But
as mentioned, as I see it it's like it's almost intentionally obfuscated
in the standard, so I don't want to delve into it.

I believe the obfuscation is (maybe unintentionally but even so) in
support of the "in the know" principle, that if you know this or that
magical tidbit of information, the input to that makes a one-way
function produce a certain commonly known result (which is what you
actually need), then you're in the in-group, e.g. SO-recognized C++
language lawyers.

But from my point of view that's a silliness, and there's no honor in
being in that group.


Cheers!,

- Alf (sorry for only providing a direction)

Tim Rentsch

unread,
Mar 18, 2019, 12:47:11 PM3/18/19
to
"Alf P. Steinbach" <alf.p.stein...@gmail.com> writes:

> On 17.03.2019 16:45, Tim Rentsch wrote:
>
>> "Alf P. Steinbach" <alf.p.stein...@gmail.com> writes:
>>
>>> On 11.03.2019 18:51, Tim Rentsch wrote:
>>>
>>>> "Alf P. Steinbach" <alf.p.stein...@gmail.com> writes:
>>>>
>>>>> C++17 has guaranteed copy construction elision, where earlier
>>>>> standards just /permitted/ it.

[..long discussion..]

>> I have looked at this question again, and in a bit more detail.
>> It still looks like temporary materialization doesn't interact
>> with copy elision, except that it might change a candidate for
>> copy elision from being one that is required to one that is
>> allowed but not required. If you do dig into this question again
>> I would be interested to hear what you find out.
>
> I think you'd better check Stack Overflow for an answer about how the
> wording works.

My experience with stackoverflow is that it's a pretty mixed bag.
In this case though looking at stackoverflow led me pretty
quickly to a particular page on cppreference, which definitely
helped. Thank you for making the suggestion.

> I believe the obfuscation is (maybe unintentionally but even so) in
> support of the "in the know" principle, that if you know this or that
> magical tidbit of information, the input to that makes a one-way
> function produce a certain commonly known result (which is what you
> actually need), then you're in the in-group, e.g. SO-recognized C++
> language lawyers.

I have only just started looking into this in detail, but my
impression so far is that the confusion is largely historical in
making.

> But from my point of view that's a silliness, and there's no honor in
> being in that group.

I don't pretend to understand the social norms on stackoverflow.
If I can find what I'm looking for, that's fine, I'll take it,
and otherwise it's off to look in other venues.
0 new messages