- Split up vector for concurrent processing - 2 Updates
- A teaching that's worth hearing - 3 Updates
- C++17 (article) - 1 Update
- In what scenarios can std::set::erase(const key_type& key); crash a process? - 4 Updates
- [ot]obj oriented language, the case of error - 8 Updates
- Think God can't forgive your sin? - 4 Updates
- i say c++ has problems in debugging template - 1 Update
- {} initialization inconsistency - 2 Updates
Jorgen Grahn <grahn+nntp@snipabacken.se>: Oct 12 05:39PM On Tue, 2017-10-10, David Brown wrote: ... > const std::vector<double> vect { 1.0, 2.0, 3.0, 4.0 }; > std::cout << sum_in_parallel(vect) << '\n'; > } It's funny how strange it feels to read complete, clear, sensibly formatted code on comp.lang.c++ ... /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
Christian Gollwitzer <auriocus@gmx.de>: Oct 12 09:50PM +0200 Am 12.10.17 um 19:39 schrieb Jorgen Grahn: >> } > It's funny how strange it feels to read complete, clear, sensibly > formatted code on comp.lang.c++ ... It is even stranger how this is clear code if you can achieve the same thing with #pragma omp parallel for reduction(+:sum) for (size_t i =0; i < vect.size(); i++) { sum += vect[i]; } Christian |
bitrex <bitrex@de.lete.earthlink.net>: Oct 11 08:02PM -0400 On 10/11/2017 05:15 PM, Alf P. Steinbach wrote: > Cheers!, > - Alf When used as an adjective to modify a pejorative like that just mentally substitute "Turbo" or "Ultra" or some other marketing term of that type |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Oct 12 06:52PM +0100 On 11/10/2017 22:15, Alf P. Steinbach wrote: > Don't use such words, please. > I'd have to google that "egregious". > I can understand the direction it goes in, from the context, that's all. Alf, if you can't call egregious cunts egregious cunts then what can you call them? /Flibble |
"Öö Tiib" <ootiib@hot.ee>: Oct 12 11:22AM -0700 On Thursday, 12 October 2017 20:52:40 UTC+3, Mr Flibble wrote: > > I can understand the direction it goes in, from the context, that's all. > Alf, if you can't call egregious cunts egregious cunts then what can you > call them? It is possibly good idea to avoid posting such noise entirely. Adding noise does not improve signal per noise ratio. If you really feel like you must to ... then may be at least vary it. For random examples: "atrocious snatch", "deplorable twat", "flagrant muff", "grievous vagina", "heinous gash", "nefarious pudenda" ... noise is noise ... does not really matter. |
Andrey Karpov <karpov2007@gmail.com>: Oct 12 11:10AM -0700 C++ language is constantly evolving, and for us, as for developers of a static analyzer, it is important to track all its changes, in order to support all new features of the language. In this review article, I would like to share with the reader the most interesting innovations introduced in C++17, and demonstrate them with examples. Link: https://www.viva64.com/en/b/0533/ |
Paavo Helde <myfirstname@osa.pri.ee>: Oct 12 10:09AM +0300 On 12.10.2017 0:32, Christopher Pisz wrote: > On Wednesday, October 11, 2017 at 3:32:14 PM UTC-5, Öö Tiib wrote: >> On Wednesday, 11 October 2017 02:25:16 UTC+3, Christopher Pisz wrote: [...] >>> where the crash dump is pointing every time, on some 50 machines. >> Then reproduce it with full program first. > Again, I cannot reproduce it, not even with the full program. However, it happens 100% of the time in production. The only difference really is the amount of load. I cannot simulate that many connections with the hardware given to me. This definitely seems like a multi-threading bug. These are sometimes notoriously hard to find. Some random thoughts: The C++ std::set::erase() itself is correct. As you did not find the bug immediately, then most probably your Remove() is also correct. The bug is probably elsewhere. Note that it is not enough if your Add and Remove are protected by a mutex, all read-only accesses must be protected too. And you cannot store a set iterator outside of the mutex lock unless you are 100% sure no other thread will delete the pointed item meanwhile. Review all your locks. If you are using a RAII mutex lock like std::lock_guard (like you should), then it is very easy to accidentally lock it only for 1 line: std::lock_guard(myMutex); instead of the correct std::lock_guard myLock(myMutex); For reproduction the bug in development: - find a machine with as many physical cores as you can. - ensure your program will use as many threads as it can in parallel. - ensure there is a loop in the main() or similar so it runs indefinitely - start the program in debugger, stopping on segfaults. - wait until it crashes, study the call stacks in all threads. You might need to wait for hours if you are running in Debug or on less cores than the customer. - if needed, repeat until the culprit function or thread starts to pop out statistically in the thread stacks. HTH Paavo |
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Oct 12 10:45AM +0100 On Thu, 12 Oct 2017 10:09:39 +0300 Paavo Helde <myfirstname@osa.pri.ee> wrote: [snip] > mutex, all read-only accesses must be protected too. And you cannot > store a set iterator outside of the mutex lock unless you are 100% > sure no other thread will delete the pointed item meanwhile. A propos of which, my low opinion of online videos as a teaching source was amplified by a talk I saw Herb Sutter give on C++11 threads a number of years ago, in which he proclaimed that "const means thread-safe". In doing so he neglected to mention that the code that the programmer is examining may hold an object by const reference and/or only call const methods on it, but in a multi-threaded program some other thread may hold a mutable reference to it and be concurrently modifying it. Such modification by another thread virally introduces thread unsafety unless all accesses having locking provided for them, including the reads. He of course new this, but his summarizing of the issue with "const means thread-safe" for the purposes of his video was highly misleading. Chris |
Jorgen Grahn <grahn+nntp@snipabacken.se>: Oct 12 12:51PM On Wed, 2017-10-11, James R. Kuyper wrote: > production environment, or letting the program randomly crash for > unexplained reasons in the production environment. If they prefer the > latter, give them what they want. It's also worth asking the Authorities if you maybe should have full-scale systems, load generators, and testers and developers using them. I spend many years at a place where we built and sold complex servers. We had all of those aids, and it was money well spent; we needed them. > one used in ordinary production, my input and output files don't > interfere in any way with the regular production system, which uses a > different Archive Set. Making systems that can be debugged in production-like setups ... it pays off to spend some effort on that, too. /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o . |
"Öö Tiib" <ootiib@hot.ee>: Oct 12 11:03AM -0700 On Thursday, 12 October 2017 12:45:41 UTC+3, Chris Vine wrote: > including the reads. > He of course new this, but his summarizing of the issue with "const > means thread-safe" for the purposes of his video was highly misleading. Oh? If something may write into that const then what const it is? It is not const. The const is promise that nothing writes into it. When something writes into it then that is entirely different situation where we need RW locks. Note that RW lock has pile of names: "readers–writer lock", "shared-exclusive lock", "multiple readers/single-writer lock", "multi-reader lock" and also "push lock". In POSIX it is called "pthread_rwlock_t" and in C++ it is called "std::shared_mutex" since C++17. ;) You may certainly use it in a way that const-qualified member functions use lock_shared, try_lock_shared and unlock_shared of std::shared_mutex and non-const member functions use lock, try_lock and unlock of it. Then you have both const and thread safety like Herb Sutter said. :D |
asetofsymbols@gmail.com: Oct 12 02:44AM -0700 What about these law for the objects error set: 1)Each object, in each type it is a pointer to memory 2)If that pointer it is 0 or NULL we call it: "Object error for that type" 3)any operation find errors produce only objects error (null pointers) 4) Each print function had to print the error object as ErrorObj type. For example in "int n;" n would be a pointer in a memory of 32 bits the really n would be *n or something as that |
"Fred.Zwarts" <F.Zwarts@KVI.nl>: Oct 12 03:45PM +0200 schreef in bericht news:e7ffb7a8-1567-42e4-9b23-8405312bf3b2@googlegroups.com... >if I have type list<T> than its error >element could be one list of element of type T of one element, and that >element is the error element of T. The values FF (hex) for an unsigned byte and 128 (dec) for a signed byte are currently valid values, which are used on many occasions. A programming language should not change that. Suppose such a value must be read from or written to a device register in a device driver. Would that be possible in the language you propose? |
asetofsymbols@gmail.com: Oct 12 08:28AM -0700 I remember for the C standard are ok signed char values -127..127 So -128 could be implemented as one error value... |
scott@slp53.sl.home (Scott Lurndal): Oct 12 04:09PM >I remember for the C standard are ok signed char values -127..127 >So -128 could be implemented as one error value... And the bit pattern for -128 in a twos-complement system is what, exactly? |
asetofsymbols@gmail.com: Oct 12 10:04AM -0700 Scott Lurndal wrote: >I remember for the C standard are ok signed char values -127..127 >So -128 could be implemented as one error value... And the bit pattern for -128 in a twos-complement system is what, exactly? --- It would be 0x80 or 128 as unsigned (1000 0000 as binary) Right? |
red floyd <dont.bother@its.invalid>: Oct 12 10:24AM -0700 > It would be 0x80 or 128 as unsigned > (1000 0000 as binary) > Right? And why should that considered to be an invalid value? "Invalid" values are defined by the program. |
scott@slp53.sl.home (Scott Lurndal): Oct 12 05:31PM >It would be 0x80 or 128 as unsigned >(1000 0000 as binary) >Right? No. It would be 1 1000 0000. It can't be represented in 8 bits. $ printf '%x\n' $(( -128 )) ffffffffffffff80 |
"James R. Kuyper" <jameskuyper@verizon.net>: Oct 12 01:47PM -0400 On 2017-10-12 13:31, Scott Lurndal wrote: > No. It would be 1 1000 0000. It can't be represented in 8 bits. > $ printf '%x\n' $(( -128 )) > ffffffffffffff80 ?? ~/testprog(108) cat schar_min.c #include <limits.h> #include <stdio.h> int main(void) { union{ signed char sc; unsigned char uc; } u = {SCHAR_MIN}; printf("%x %d\n", u.uc, u.sc==-128); } ~/testprog(111) gcc -std=c99 -pedantic -Wall -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wmissing-prototypes schar_min.c -o schar_min ~/testprog(112) ./schar_min 80 1 |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 12 08:07AM -0700 Here's a message for those who think the sin they've done is too big for God to forgive them. You underestimate the power of God, and of what Jesus did at the cross, if you think your sin is too weighty for God. God is able to save everyone to the uttermost. We receive His perfect righteousness, as His free gift when we ask Him to forgive our sin: Cries of the lost https://www.youtube.com/watch?v=ohLh68W2frc Eternity is calling you. God wants you to be with Him in Heaven. He invites you to come and to ask His Son to forgive your sin, and in so doing to gain eternal life. This knowledge comes through the heart, the core of your being, that thing you can't shake when you look yourself in the mirror and there are no distractions. If you know God is calling you, answer Him and rejoice! He is calling out to save your eternal soul, to give you eternal life on even the streets of gold. Thank you, Rick C. Hodgin |
asetofsymbols@gmail.com: Oct 12 08:34AM -0700 One has to do penitence for sins but too has to repair the wrong results of his own sins, and have to say or believe he - she never remake (make one more time ) them. But first of this one has to know commands and where are his own sins... |
asetofsymbols@gmail.com: Oct 12 08:37AM -0700 Commands == commandments |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 12 09:33AM -0700 > One has to do penitence for sins but too has to repair the wrong results of his own sins, and have to say or believe he - she never remake (make one more time ) them. > But first of this one has to know commands and where are his own sins... Tell that to the thief on the cross. All he did was ask the Lord to remember Him when He entered into His Kingdom. He did not do anything other than come to the place of acknowledging he was a sinner, and to then receive salvation, a free gift by God. https://www.biblegateway.com/passage/?search=Ephesians+2%3A8-9&version=KJV 8 For by grace are ye saved through faith; and that not of yourselves: it is the gift of God: 9 Not of works, lest any man should boast. There is nothing you can do to earn salvation. It is God's gift to you. https://www.biblegateway.com/passage/?search=Luke+23%3A42-43&version=KJV 42 And he said unto Jesus, Lord, remember me when thou comest into thy kingdom. 43 And Jesus said unto him, Verily I say unto thee, Today shalt thou be with me in paradise. The thief on the cross received grace and mercy because he asked the Lord, and was at a true place of repentance. The other thief on the cross mocked the Lord, and received eternal condemnation. ----- There is nothing we must do to be saved, except to ask Jesus to forgive our sin, and be at a true place of repentance. You cannot parrot the words, "Lord, forgive me," with no meaning behind it in your heart and be saved. It must be a real outreach and expression of the true changed inner state of your core being, that you are truly repentant, and you do truly want to be saved. That change is something only God can do: https://www.biblegateway.com/passage/?search=John+6%3A44&version=KJV 44 No man can come to me, except the Father which hath sent me draw him: and I will raise him up at the last day. God is spirit, and our spirit is dead because of sin. And until God performs a spirit miracle within us, we cannot even acknowledge Him, let alone come to Him and ask forgiveness. But, as He commands that our spirit be made alive, and we are drawn by His grace and mercy to His Son, then are we drawn with power and authority from within to boldly come to God and ask forgiveness, in much weeping and tears, so that we will not be ashamed at the appearing of His glory, but then do we pass from death to life in that instant, and are forever alive, and are able to from that day forward discern matters of the spirit, and His continual presence within us will draw us closer and closer to Him. But our flesh remains as it was, corrupt and in sin, and it is an ongoing constant battle. Our flesh wants this, our spirit wants that. We must focus and discipline ourselves so our bodies do not dictate our direction, but rather our spirit, and our inner love of God being manifest into all areas of our lives. It's why God asks us to go ye therefore and make disciples, and to teach them all things He has commanded, and to obey them. They are guards in our lives. Things He's given us to protect us. When we are following after His ways we are protected from the enemy's attempts to destroy us. When we go our own way, the enemy is greater than we are, and he quickly consumes us in sin and ties us down and binds us up. But God is greater. And for all who will hear the truth, He will do the supernatural miracle things in your life that are impossible for man, and He will bring you to salvation and begin a good work in you: https://www.biblegateway.com/passage/?search=Philippians+1%3A6&version=KJV 6 Being confident of this very thing, that he which hath begun a good work in you will perform it until the day of Jesus Christ: You're not strong enough to derail His plans for your life. Nor is the enemy. So just keep relying upon Him and He'll bring you out of and through everything the enemy throws at you. It may hurt. There may (will) be worldly loss, but your spirit and soul are His target for being strengthened, grown up (maturing), and improving in service to Him, much as we go through school and training here on Earth, so He takes us through something similar spiritually. I love each of you ... which is why I teach you these things. Thank you, Rick C. Hodgin |
asetofsymbols@gmail.com: Oct 12 12:16AM -0700 It seems this error was corrected; this fail to compile on a template was one of few error I not had understood |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Oct 12 02:05AM +0200 > The paragraph I deleted did not clarify that identification of > something as a diagnostic is entirely at the implementation's > discretion, Train on reading, my friend. > it's not limited to a binary distinction between "warnings" and > "errors". And train on not offering this kind of absurd misrepresentation. How many times must I tell you that the standard does not mention error versus warning diagnostics, at all. I mean, so that it registers, instead of being deleted by you, to provide a misleading context for your own remarks? When you clarify, in a debate with someone, that there are more possibilities than X and Y, then you are implying that the someone has labored under a misconception that only X and Y were possibilities. That's pretty dumb to do when you've just deleted the someone's paragraph discussing a third possibility: > you dismissed them as if permission to use those other possibilities > was an unintentional defect in the standard, rather than a deliberate > decision on the part of the committee. Not sure if it is a defect, but it's definitely a potential for improvement. > reached. I generally prefer to provide citations rather than > arguments, where possible, leaving the reader free to reach his own > conclusions about the meaning of the cited text. If you don't like discussion & valuations then sit down alone with the standard. It's available to everyone. >> Your statement implies that the standard talks about warnings >> versus errors: it doesn't. > I intended no such implication, and I see no such implication. You wrote "A "warning" qualifies as a diagnostic message for purposes of standard-conformance" followed by a not quoted reference to the standard (presumably C++14). As if that reference said what you said. It doesn't. It doesn't even use or mention that concept. Keep in mind that readers don't have in front of their eyes what you have in front of yours: their context is just what you /write/, not what you see when you're writing it. So again, I suggest you train on reading – not just what others write, but also what you write yourself. > standard-conformance, so long as the implementation's documentation > identifies it as such." Perhaps the absurdity of that true statement > would have made my point clearer? Yes, except that the point was made in my posting that you replied to. Cheers & hth., - Alf |
jameskuyper@verizon.net: Oct 11 08:28PM -0700 On Wednesday, October 11, 2017 at 8:05:56 PM UTC-4, Alf P. Steinbach wrote: > On 10/11/2017 11:46 PM, jameskuyper@verizon.net wrote: > > On Wednesday, October 11, 2017 at 5:13:12 PM UTC-4, Alf P. Steinbach > > wrote: ... > How many times must I tell you that the standard does not mention error > versus warning diagnostics, at all. I don't know. How long will it take you to realize that I never suggested otherwise? If you have no intention of recognizing that truth, I recommend dropping it here, I'm not going to bother responding again on that point. > labored under a misconception that only X and Y were possibilities. > That's pretty dumb to do when you've just deleted the someone's > paragraph discussing a third possibility: Not if that paragraph dismisses those possibilities with wording that incorrectly implies that allowing those possibilities was unintentional. ... > standard-conformance" followed by a not quoted reference to the > standard (presumably C++14). As if that reference said what you said. It > doesn't. It doesn't even use or mention that concept. You dropped a key phrase from that sentence "... so long as the implementation's documentation identifies it as such.". As a general rule, if your understanding of a sentence I've written is unchanged by removing a clause from that sentence, then you should consider the possibility that you didn't understand it correctly. My sentences do tend to be overly long and complicated, but their intended meaning generally depends upon all of those complications. |
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