- C++ move constructors - 12 Updates
- C++ move constructors - 1 Update
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. |
blt_4h9eyv9m_7@ai8rhnz2.com: Mar 05 05:16PM On Tue, 5 Mar 2019 08:35:41 -0800 (PST) >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_3cgb97v7@iword.net: Mar 05 05:19PM On Tue, 5 Mar 2019 08:46:44 -0800 (PST) >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. >> 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. |
jameskuyper@alumni.caltech.edu: Mar 05 09:35AM -0800 > 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 <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. |
Daniel <danielaparker@gmail.com>: Mar 05 10:12AM -0800 > >when instead of communication you want to pretend being an > >idiot. > Its 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 |
jameskuyper@alumni.caltech.edu: Mar 05 10:27AM -0800 > >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. |
"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_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. |
blt_t6tbvj09jy@qrzz1g0rb.ac.uk: Mar 05 04:08PM On Tue, 5 Mar 2019 12:16:30 +0100 >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. >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_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). |
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. |
ram@zedat.fu-berlin.de (Stefan Ram): Mar 05 06:47PM >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 Only recently, in Message-ID: <blast-20190202162842@ram.dialup.fu-berlin.de> Newsgroups: comp.lang.c Subject: A blast from the future , I posted code where »++i« is "translated into" »subl $1,«. main.c #include <stdio.h> #include <stdlib.h> #include <math.h> int main( void ) { int i = 429; a:; ++i; int c; srand( c ); c = 7; srand( c ); if( i < 432 )goto a; } translation (reformatted by me [S.R.]) movl $3, %ebx a: movl $7, %ecx call srand movl $7, %ecx call srand subl $1, %ebx jne a The whole idea that a small function is "translated into" something often cannot be applied today, because a small function will often be inlined and then the result will be optimized and the result of that optimization might not have a single region that can be identified with the call of the function anymore. |
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