- A programmig error reported at the cppcon - 1 Update
- C++ has #define; use it. - 12 Updates
- Qucksort for Linked List - 8 Updates
ram@zedat.fu-berlin.de (Stefan Ram): Dec 27 11:09PM I try to summarize, as I understand it, a programming error that was reported at the cppcon: The essential point seems to have been code like: int x; if( x )x = 0; . Assume, you want x to be 0, but in a situation where a write access is expensive. So you first check whether it happens to already be zero. Turns out, after this, x might still not be zero! The cppcon explanation went like this: The kernel might know that the program reads from uninitialized data and return 0 for »x« without actually reading it, because it knows that in this case it is free to return any value. Later, someone might write into the page that holds x and this might cause the page to be created or loaded or something and then subsequent read accesses to x will return the actual value in the storage which might not be 0. The explanation was given to sound somewhat difficult to comprehend so as to show how complicated all this is. But I believe a C++ programmer might take a more abstract point of view: We do not have to know anything about pages and kernels! It suffices to know that reading from uninitialized storage causes undefined behavior, which means that the program from now on can do anything. This includes the possibility that consecutive read accesses to the same uninitialized object may return different values without any intervening write access to this object. |
Jeff-Relf.Me <@.>: Dec 27 10:38AM -0800 |
woodbrian77@gmail.com: Dec 27 10:54AM -0800 On Tuesday, December 27, 2016 at 1:24:12 AM UTC-6, jonkalb wrote: > When I first saw your coding guidelines I honestly thought you had your tongue in your cheek and were writing one of those lists where instead of giving good advice you deliberately give bad advice to dramatize common mistakes and show people what to avoid. > It is only after reading your responses to the comments here that I realized that you were sincere in your recommendations. > Jeff, I'm really happy that writing code this way has put food on your table since 1981. My guess is that, since you happen to be exactly my age, it is too late for you to learn "new tricks" so you'll almost certainly just run out the clock on your career writing code like this. I don't think that's too old to learn new tricks. > But I beg of you, two things. One is that you never ask me to review or any way work with any code you've ever written and the second is that you never share your coding standards or other coding advise with anyone else in the C++ community. Ever. I tend to agree with what he wrote about using fewer/bigger functions. I used to have more functions in this program: https://github.com/woodbrian/onwards/blob/master/cmwAmbassador.cc The size of the text segment was reduced by getting rid of some of the functions. That was the case with a number of popular compilers. And the number of lines of code was also reduced. So I went with it as both of those are important to me. He also wrote about global functions. It seems to me there's been a move toward free functions over the past decade or so that may be similar to what he means. Free functions aren't necessarily global, but they are closer to global than member functions in my opinion. I considered his "Loop" macros and searched through my code for places where I could use something like that. I only found a handful of places. I don't plan on using that. Brian Ebenezer Enterprises - I'm glad to hear that Israel is curbing relations with Senegal, New Zealand, Britain, France, Russia, China, Japan, Ukraine, Angola, Egypt, Uruguay and Spain due to their anti-semitism. I've been reducing what I buy from China and will continue to buy American and Taiwanese products instead. http://webEbenezer.net |
Jeff-Relf.Me <@.>: Dec 27 10:56AM -0800 |
Paavo Helde <myfirstname@osa.pri.ee>: Dec 27 09:38PM +0200 On 27.12.2016 20:56, Jeff-Relf.Me wrote: > Compiling C++ is trivial, always. > Testing your code can be problematic, sure; > but _not compiling, _never. I am pretty sure you are the first one coming up with such a claim in this group. We should give you a medal or something. > As I said ( in " http://Jeff-Relf.Me/cStyle.HTM " ): > Put everything in a single, large .CPP file; > -- don't create .H files. And with what editor I would edit that million-line file? At least I would have lots of free days when the next one-line change is compiling ;-) |
Jeff-Relf.Me <@.>: Dec 27 11:56AM -0800 |
Mr Flibble <flibble@i42.co.uk>: Dec 27 08:01PM On 27/12/2016 19:38, Paavo Helde wrote: > And with what editor I would edit that million-line file? > At least I would have lots of free days when the next one-line change is > compiling ;-) Don't feed the troll. /Flibble |
Jeff-Relf.Me <@.>: Dec 27 12:16PM -0800 |
Paavo Helde <myfirstname@osa.pri.ee>: Dec 27 10:20PM +0200 On 27.12.2016 22:01, Mr Flibble wrote: >> On 27.12.2016 20:56, Jeff-Relf.Me wrote: > Don't feed the troll. > /Flibble Come on, he is almost as funny as you! Though your insights into maths are hilarious, he probably cannot beat you in that area ;-) |
Paavo Helde <myfirstname@osa.pri.ee>: Dec 28 12:02AM +0200 On 27.12.2016 21:56, Jeff-Relf.Me wrote: >> change is compiling ;-) > My 2 MegaByte .CPP files compile in no time. > How big are yours ( in MegaBytes, not lines ) ? This is because your CPP file is a renamed .c file with with no usage of C++ features and not including any standard headers (because STL wasn't around in 1976 I guess, it was started only in 1979). As a result, most of your file is a poor reimplementation of standard STL utilities and could be compressed 20x when rewritten in proper C++. As to answer your question, the current source code written by our group for our product is 33 MB / 748308 lines. It recompiles in ca 20 minutes thanks to SSD disks. The recompile of the whole workspace with third-party libraries (another 600 MB of C and C++ code) takes about 2 hours. But I'm sure that if this 33 MB is put into a single file then the recompilation times would become infinite because the compilers would choke and hang on it. So, keep up the good work in turning the clock back. I would like to have back the sixties with happy hippies and no concerns, can you make that? |
Vir Campestris <vir.campestris@invalid.invalid>: Dec 27 10:14PM On 27/12/2016 20:16, Jeff-Relf.Me wrote: > _Loop() works fine; I don't use "concurrent_vector.h"; > even if I did, my local definition OverRides it. > I could change the name, of course. I don't create .H files. The point is that _you_ are forbidden to use a name like that. They are reserved for the compiler, and the next release of the compiler is quite entitled to #define it to something that causes really weird errors. And please don't post those funny font settings. Andy |
Ian Collins <ian-news@hotmail.com>: Dec 28 11:26AM +1300 > relations with Senegal, New Zealand, Britain, France, Russia, > China, Japan, Ukraine, Angola, Egypt, Uruguay and Spain due to > their anti-semitism. Fuckwit. -- Ian |
Jeff-Relf.Me <@.>: Dec 27 02:58PM -0800 |
Gareth Owen <gwowen@gmail.com>: Dec 27 06:52PM > This of course is predicated on ω being a variable and not a > classification: if it is a classification then I assume it means > something along the lines of: It's the first transfinite ordinal - which you'd know if ... oh, never mind. Suffice to say, it's the correct and normal notation used in explaining the Hilbert Hotel paradox and such like, a formally correct way of writing what we casually think of as 1+∞ = ∞ |
Mr Flibble <flibble@i42.co.uk>: Dec 27 07:06PM On 27/12/2016 18:52, Gareth Owen wrote: > the Hilbert Hotel paradox and such like, a formally correct way of > writing what we casually think of as > 1+∞ = ∞ Not the same thing at all which you'd know if you weren't an autsy fucktard*. /Flibble * Not all autistic people are fucktards |
Gareth Owen <gwowen@gmail.com>: Dec 27 07:17PM > Not the same thing at all which you'd know if you weren't an autsy > fucktard*. You're funny. Not massively smart, but funny. |
Mr Flibble <flibble@i42.co.uk>: Dec 27 09:05PM On 27/12/2016 19:17, Gareth Owen wrote: >> Not the same thing at all which you'd know if you weren't an autsy >> fucktard*. > You're funny. Not massively smart, but funny. Not smart? Infinity is not a member of the set of ordinals (which must be integers). As I said you are the fucktarded one not me. /Flibble |
Gareth Owen <gwowen@gmail.com>: Dec 27 09:15PM >> You're funny. Not massively smart, but funny. > Not smart? Infinity is not a member of the set of ordinals (which must > be integers). As I said you are the fucktarded one not me. Omega is the first "transfinite ordinal". This is first-year university level mathematics, so you won't have come across it. It is the ordinal associated with the set integers but is not itself an integer. Rather it is a member of a larger set of which the integers are a proper subset. Note the first and fourth bullet points on this page https://en.wikipedia.org/wiki/Transfinite_number which prove, once again, that you don't know what you're talking about. Go read a maths book above high school level, Leigh. Actually, don't, you're much less boring when you're being stubbornly ignorant. Also, didn't claim to have killfiled me last week? Can you do it again please? I much prefer it when you don't reply to me, as I don't feel obliged to endlessly point out how you know. |
Mr Flibble <flibble@i42.co.uk>: Dec 27 09:21PM On 27/12/2016 21:15, Gareth Owen wrote: > Also, didn't claim to have killfiled me last week? > Can you do it again please? I much prefer it when you don't reply to me, > as I don't feel obliged to endlessly point out how you know. You are full of shit. Just as with the Riemann sphere, extended complex plane and projective geometry which are all bullshit you think infinity can be a member of a set. Infinity is NOT an ordinal number; these abstractions are made up by minds which were fried; you have been drinking the too much koolaid (or your mind is also fried) if you think differently. /Flibble |
Gareth Owen <gwowen@gmail.com>: Dec 27 09:29PM > infinity can be a member of a set. > Infinity is NOT an ordinal number; these abstractions are made up by > minds which were fried Would that my mind were capable of functioning on the level of Georg Cantor's. Would that yours were.... > you have been drinking the too much koolaid (or your mind is also > fried) if you think differently. If you actually believe this, you are a moron, Leigh. If you don't believe this, you are just another emo-kid troll, and not one of the better ones. Either way, I no longer find you sufficiently entertaining, so *plonk* (My killfile, you'll discover, is not a lie used to escape an argument) |
Mr Flibble <flibble@i42.co.uk>: Dec 27 09:33PM On 27/12/2016 21:29, Gareth Owen wrote: > Either way, I no longer find you sufficiently entertaining, so *plonk* Finally. > (My killfile, you'll discover, is not a lie used to escape an argument) This is great news; it means I no longer have to reply to your absurd arguments. /Flibble |
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