- We've won! - 7 Updates
- constexpr issues - 1 Update
- How to detect wrong Constructor usage... Object A(arguments) vs Object(arguments) - 1 Update
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Nov 26 06:42PM On 26/11/2018 00:48, Rick C. Hodgin wrote: > in the process. You can help people AND lift them up / encourage them at the same time. > I hope you don't have children, Leigh, or if you do you don't address > them with such discourse. If I wanted advice from you I would ask for it but that is never going to happen so fuck off. /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Nov 26 11:53AM -0800 On Monday, November 26, 2018 at 1:42:54 PM UTC-5, Mr Flibble wrote: > If I wanted advice from you I would ask for it but that is never going to > happen so .. . Self-examine your treatment of others, Leigh. You're not a nice person. You're not friendly. You're not helpful. You are mean and rude and hateful and egotistic. It comes across in everything we see of you on this forum. It doesn't have to be like that, but it will be so long as you keep pursuing that attitude. There is another way. The choice is yours. -- Rick C. Hodgin |
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Nov 26 12:08PM -0800 On 11/26/2018 1:19 AM, David Brown wrote: > Chris, I appreciate your posts here. You are explaining the issues here > - I have learned a good deal since you entered this discussion, > certainly more than from all of Chris T.'s "It works. Period." posts. I agree with you: Tip of the hat to Chris Vine for his very nice explanations; MUCH better than my it works, period crap, sorry David. I even referred you to one of his posts because it was damn near perfect. > little note in the description of multi-threaded execution in the > standards (I'm taking it from C11, but there is an almost identical note > in C++11): [...] Btw David, what compilers can you find that actually support C11? So far, I can only find one: Pelles C, however it has some "issues" wrt double-width compare-and-swap (DWCAS): https://forum.pellesc.de/index.php?topic=7311.0 ;^o |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Nov 26 08:12PM On 26/11/2018 19:53, Rick C. Hodgin wrote: > It doesn't have to be like that, but it will be so long as you > keep pursuing that attitude. > There is another way. The choice is yours. I said I don't need advice from the likes of you. FUCK OFF. /Flibble -- "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
David Brown <david.brown@hesbynett.no>: Nov 26 09:50PM +0100 On 26/11/2018 21:08, Chris M. Thomasson wrote: > I agree with you: Tip of the hat to Chris Vine for his very nice > explanations; MUCH better than my it works, period crap, sorry David. I > even referred you to one of his posts because it was damn near perfect. No problem, Chris T. - my tone was not the friendliest in all my posts either. I have now learned more about what is guaranteed to work correctly - and I think perhaps you have learned a little more about /why/ it is guaranteed, and where in the standards we can find the relevant points. It has been a fruitful discussion for me. > double-width compare-and-swap (DWCAS): > https://forum.pellesc.de/index.php?topic=7311.0 > ;^o gcc has full C11 support, AFAIK. But I think the question you really mean is which /library/ has full C11 threading and atomic support - this is a matter for the implementation (compiler plus library plus host OS), not compiler alone. I do very little C programming on hosted systems, so I can't help here - I work on small embedded systems. Those are the kind of systems where "volatile" /does/ work for multi-threading interactions (used appropriately, of course), and where implementation-specific code and features are fine. And the OS'es in my world are often written in C90 - not even C99. |
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Nov 26 09:45PM On Sun, 25 Nov 2018 14:05:21 -0800 "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> wrote: [snip] > "The following functions synchronize memory with respect to other threads." > Define synchronize? At least C++11/C11 defines it as an acquire-release > relationship. ;^) Those (such as a few gcc developers at the time) who argued back then that the problem you referred to wasn't a gcc bug had to contend with something else in section 4.12 of the SUS. That section also says: "Applications shall ensure that access to any memory location by more than one thread of control (threads or processes) is restricted such that no thread of control can read or modify a memory location while another thread of control may be modifying it". This defines the POSIX equivalent of what is called a "data race" in C++11[1]. You would have thought that this would have precluded gcc applying an optimization which breaks this POSIX requirement. This came to a head in the linux kernel. When writing to an int in a struct for Itanium, gcc had taken to writing not just to the 32-bit int in question, but to a 64-bit value (and then restoring the trampled on remaining 32 bits) on the grounds that it was faster on Itanium. There was a famous Linus Torvalds rant about it. The explanation from those who thought that this was OK was that "memory location" wasn't defined in POSIX and so it meant the natural size of the bus, in this case 64 bits (aka it meant what they wanted it to mean). The fact that this would break any perfectly good multi-threaded code which happened not to be aligned on the relevant boundaries didn't seem to worry those holding this position. After the Torvalds rant the position was changed. Those preparing the C++11 memory model took care to prevent this kind of nonsense. It defines "memory location" as "A memory location is either an object of scalar type or a maximal sequence of adjacent bit-fields all having non-zero width" (§1.7/3). So even objects of char type are a "memory location" which can't be trampled on by an optimization. It also added an explicit note in §1.10/22: "Note: Compiler transformations that introduce assignments to a potentially shared memory location that would not be modified by the abstract machine are generally precluded by this standard, since such an assignment might overwrite another assignment by a different thread in cases in which an abstract machine execution would not have encountered a data race. This includes implementations of data member assignment that overwrite adjacent members in separate memory locations". The last sentence explicitly dealt with the issue which had arisen on the linux kernel. Chris [1] §1.10/4 of C++11 is the equivalent: "Two expression evaluations conflict if one of them modifies a memory location (1.7) and the other one accesses or modifies the same memory location" read with the definition of "data race" in §1.10/21. |
"Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid>: Nov 26 02:52PM -0800 On 11/26/2018 12:50 PM, David Brown wrote: > correctly - and I think perhaps you have learned a little more about > /why/ it is guaranteed, and where in the standards we can find the > relevant points. It has been a fruitful discussion for me. A very fruitful discussion indeed. I just knew that the mutex lock/trylock acts like an acquire, and unlock acts like a release, which have fence semantics that does have compiler barriers that ensure the trylock example works in C11/C++11, in fact they ensure that all mutex operations work. Chris Vine very kindly pointed it out in the standard which ended up helping _everybody_ out. >> ;^o > gcc has full C11 support, AFAIK. But I think the question you really > mean is which /library/ has full C11 threading and atomic support Yes, exactly. To be more exact, how many people can find a compiler that does not define the macro constant __STDC_NO_THREADS__? > interactions (used appropriately, of course), and where > implementation-specific code and features are fine. And the OS'es in my > world are often written in C90 - not even C99. Everything works on your systems == fine with me. :^) |
wyniijj@gmail.com: Nov 26 06:36AM -0800 Öö Tiib於 2018年11月26日星期一 UTC+8下午9時01分12秒寫道: > > t2.cpp:(.text+0x6f): undefined reference to `Token::Pi' > > collect2: error: ld returned 1 exit status > > 52,40 Bot Thanks. "g++ -std=c++17 t.cpp" works well, I forgot the standard option for g++. But the standard I am after is c++11. "g++ -std=c++11 t.cpp" causes the same linker error! I can not understand why. |
peter koch <peter.koch.larsen@gmail.com>: Nov 25 04:19PM -0800 søndag den 25. november 2018 kl. 23.22.02 UTC+1 skrev Paavo Helde: > int main() { > LockingObject(1); > } Ah - you are right. I got the warning in my test - using -Wall, but it is not related to the nodiscard attribute. So that is probably the solution: use -Wall. This option IMO actually should always be included. That said, it is weird that the attribute does not work in the situation above. |
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