- Very good, SergIo, I'm impressed. - 5 Updates
- bool foo = [](){}; - 1 Update
Tim Rentsch <tr.17687@z991.linuxsc.com>: Apr 11 08:57AM -0700 > If any of you want to discuss C++, then of course you are welcome > here - but without cross-posts to such a selection of random other > groups. Given your posting history, you are hardly someone to be faulting people for disregarding topicality rules. Besides which, look at the referenced web page. The line in question comes from x.cpp, which is indeed a C++ source file. |
David Brown <david.brown@hesbynett.no>: Apr 11 07:36PM +0200 > Comp.Lang.C++ covers C and assembly language, straight to the metal. No, it does not. It covers C++. There is comp.lang.c for C. For some threads, it makes sense to cross-post to c.l.c and c.l.c++, but pure C stuff goes in c.l.c. And there are assembly groups for discussing assembly. For "bare metal" programming, comp.arch.embedded is often a better place than a language-specific group, since most C++ programming is not bare metal. > We don't need a separate newsgroup for C. There /is/ a separate newsgroup for C. C and C++ have always had separate newsgroups, because they are different languages. > I presented you ( David Brown ) with some C++ code, > and you can't show me how a class would improve it. What makes you think I couldn't show how to improve it? What makes you think it has to have a class to be improved? What makes you think I said it had to be non-C C++ code to be improved? The main steps to improving that monstrosity are to fire the guy that wrote it, hire a competent programmer and write sensible code from the specifications. The choice of language - C, C++, or anything else - is a minor issue. > This ain't no Wikipedia article; > if that's what you're looking for, and you can bend at all, > then you're in the wrong fucking place. You appear to be a very muddled individual. I know what Usenet groups are - do you? > You don't know what C++ is because you're too damn retarded. > Everyone here hates you, I'm quite sure. > You're less than useless. Ah, what a clear and logical argument. Let me try one last time. There is the group comp.lang.c++ for discussing C++ topics. There is comp.lang.c for discussing C. There is comp.os.linux.advocacy that is apparently for spouting all sorts of nonsense, just as long as you are rude to each other. I have no idea whether sci.physics and news.software.readers are true to their original purposes, but if so then your thread here is out of place. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Apr 11 08:59PM +0100 > // > // iFolder is a ( zero based ) index into BB, the list of folders. > // rFolders is the number of folders remaining ( to the right of iFolder, EE - PP ). You have trolled here before with that shit. It is really simple: if you used meaningful variable names you wouldn't need comments explaining what the variables mean, fucktard. /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." |
Bart <bc@freeuk.com>: Apr 11 09:15PM +0100 On 11/04/2019 20:59, Mr Flibble wrote: >> iFolder = PP - BB, rFolders = EE - PP ; " > It is really simple: if you used meaningful variable names you wouldn't > need comments explaining what the variables mean, fucktard. Well BB=begin, EE=end I guess, but the way it's written doesn't help. Laid out properly you can still see some problems: if (PageUp) { if (--PP < BB) { PP=EE; } else { 0; } } else if (Pagedown) { if (++PP > EE) { PP=BB; } else { 0; } } else { 0: } iFolder = PP - BB; rFolders = EE-PP; What's with all those zeros? It's because ?: needs a second branch. Written in a saner manner with proper names (I've removed the middle else as not really needed): if (PageUp) { if (--PP < FirstFolder) { PP = LastFolder; } } if (Pagedown) { if (++PP > LastFolder) { PP = FirstFolder; } } iFolder = PP - FirstFolder; rFolders = LastFolder - PP; then it's just some very ordinary scrolling logic (that wraps apparently). Compare with the original: PageUp ? ( --PP < BB ? PP = EE : 0 ) : PageDwn ? ++PP > EE ? PP = BB : 0 : 0 ; iFolder = PP - BB, rFolders = EE - PP ; which tries its hardest to avoid writing normal statements. |
red floyd <dont.bother@its.invalid>: Apr 11 04:19PM -0700 On 4/11/2019 1:15 PM, Bart wrote: > PageUp ? ( --PP < BB ? PP = EE : 0 ) : PageDwn ? ++PP > EE ? PP = BB : > 0 : 0 ; iFolder = PP - BB, rFolders = EE - PP ; > which tries its hardest to avoid writing normal statements. Thanks, Bart, for the work. Had anyone where I work submitted the original code as part of a code review, he would have been seriously slapped down. It fails two of the "X-ability" tests. Readability and Maintainablilty. And the sad part is, the compiler probably generated identical code for both versions. |
Vir Campestris <vir.campestris@invalid.invalid>: Apr 11 09:27PM +0100 Spot the deliberate mistake? The real code was more like bool foo = [](){ /* various bits of logic */ return false; }; It should have been bool foo = [](){ /* various bits of logic */ return false; }(); All my test cases wanted true, and that's what I got :( it was someone else on different H/W that needed false. Why is it possible to cast a lambda to a bool? And why doesn't GCC think this is worth a warning, even on -pedantic? </rant> Andy |
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