- C++ move constructors - 25 Updates
blt_8rl_gkVt@4rbys.gov.uk: Mar 05 04:20PM On Tue, 5 Mar 2019 07:31:22 -0800 (PST) >> 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. >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). |
Paavo Helde <myfirstname@osa.pri.ee>: Mar 06 09:58AM +0200 On 5.03.2019 12:30, Bonita Montero wrote: > 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. |
Ralf Fassel <ralfixx@gmx.de>: Mar 05 11:17AM +0100 * Manfred <invalid@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' |
Ian Collins <ian-news@hotmail.com>: Mar 06 10:29PM +1300 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. |
blt_7qqoq3m@dphu.org: Mar 06 08:45AM On Tue, 5 Mar 2019 21:58:51 +0100 >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. >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. |
blt_648_1yfa6@nxy7efemiq.com: Mar 05 09:50AM On 5 Mar 2019 06:49:23 GMT >> Sam <sam@email-scan.com> wrote: >>>blt_4f6dkyzs@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. |
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Mar 05 05:47PM On Tue, 5 Mar 2019 09:50:23 +0000 (UTC) > 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. I can imagine by your postings that this kind of thing happens to you quite often. How difficult for you. |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Mar 05 02:13AM +0100 On 04.03.2019 14:20, Öö Tiib wrote: >> 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. > 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 |
Bonita Montero <Bonita.Montero@gmail.com>: Mar 06 01:24PM +0100 >> 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. ;-) |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Mar 05 04:55PM +0100 On 05.03.2019 11:37, Öö Tiib wrote: >> Yes, that's what I wrote. >> It's that simple. > You wrote that compiler has to generate code for those constructors. 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__v6@_izvfhgugsz.co.uk: Mar 05 09:48AM On Mon, 04 Mar 2019 21:38:43 +0200 > 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? |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Mar 05 02:10AM +0100 On 04.03.2019 15:39, Stefan Ram wrote: > A > B > Say what now? Try that with a copy constructor. Are you then still as surprised? Cheers!, - Alf |
David Brown <david.brown@hesbynett.no>: Mar 05 09:58PM +0100 >> 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. > [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. |
David Brown <david.brown@hesbynett.no>: Mar 05 12:16PM +0100 >> 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? 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. |
James Kuyper <jameskuyper@alumni.caltech.edu>: Mar 06 08:24AM -0500 > On Tue, 5 Mar 2019 21:58:51 +0100 > David Brown <david.brown@hesbynett.no> wrote: >> On 05/03/2019 18:16, blt_4h9eyv9m_7@ai8rhnz2.com wrote: ... >> 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. >> 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. ... >> 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? >> 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. |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Mar 05 03:48AM +0100 On 05.03.2019 03:30, Stefan Ram wrote: > 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 |
Manfred <invalid@add.invalid>: Mar 05 09:07PM -0500 On 3/5/19 5:17 AM, Ralf Fassel wrote: > The OPs question was about > Moveable(_const_ Moveable&& rhs) > for the second CTOR. Yes, the example ctor from the OP had const &&, which is incorrect as others have pointed out, but his/her question was: > 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. |
blt_1daxr209@_44t2ae_.co.uk: Mar 05 05:14PM On Tue, 5 Mar 2019 08:29:07 -0800 (PST) >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. >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. |
David Brown <david.brown@hesbynett.no>: Mar 07 10:53AM +0100 > 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. |
Sam <sam@email-scan.com>: Mar 07 07:07AM -0500 > 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. |
David Brown <david.brown@hesbynett.no>: Mar 07 10:50AM +0100 > 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 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. |
blt_a2oeug@3depem2rtoo4k9_kbk9ri.gov: Mar 05 04:06PM On Tue, 5 Mar 2019 03:10:32 -0800 (PST) >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 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. >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. |
David Brown <david.brown@hesbynett.no>: Mar 06 11:08AM +0100 >> 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 ? > 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. >> 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. >> 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_i39iw07qgX@xlicr_dm5.com: Mar 05 10:28AM On Tue, 5 Mar 2019 02:00:11 -0800 (PST) >> 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? |
Paavo Helde <myfirstname@osa.pri.ee>: Mar 07 11:06AM +0200 >> 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. |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment