- enum class or enum? - 5 Updates
- More about our identity and about globalization and nationalism.. - 6 Updates
- who's at fault, me or compiler? - 9 Updates
- Lock-Free Algorithms for Thread Safe Programming - 1 Update
- What version of C++ - 3 Updates
- Fixing some undefined behavior - 1 Update
JiiPee <no@notvalid.com>: Jul 15 05:18PM +0100 Quick question. Sometimes I think whether to use enum class or enum. enum is shorter, so is it sometimes better? Example a tic tac toe game where board piece is enum: enum class Piece {Empty, X, O}; std::vector<Piece> board; board[4] = Piece::X; Would this be better: enum Piece {Empty, X, O}; std::vector<Piece> board; board[4] = X; So that things are more compact? Putting Piece::X makes things a bit too long? I know its safer, but also it makes things longer... |
Paavo Helde <eesnimi@osa.pri.ee>: Jul 15 07:56PM +0300 15.07.2020 19:18 JiiPee kirjutas: > board[4] = X; > So that things are more compact? Putting Piece::X makes things a bit too > long? I know its safer, but also it makes things longer... Depens on the project scope. If this is a hundred line program developed during a weekend, then plain enum is fine. If this is a million-line program developed over decades, I would advocate for enum class. |
Bonita Montero <Bonita.Montero@gmail.com>: Jul 15 07:25PM +0200 If the enum is scoped inside a class anyway you might not use enum class. |
JiiPee <no@notvalid.com>: Jul 15 07:08PM +0100 On 15/07/2020 18:25, Bonita Montero wrote: > If the enum is scoped inside a class anyway you might not use enum > class. yes this is another question I ve been thinking :). But still, using enum class is safer always than enum. So even inside a class enum class would be safer... but I guess your point is that the class is small so no need to be super safe? |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jul 15 07:29PM +0100 On 15/07/2020 19:08, JiiPee wrote: >> class. > yes this is another question I ve been thinking :). > But still, using enum class is safer always than enum. So even inside a class enum class would be safer... but I guess your point is that the class is small so no need to be super safe? Often when you have an enum inside a class it is hard to think of a name for the enum that is different to the name of the class; same problem with putting enum outside of class so in this instance normal enum inside class is superior. Sausages. /Flibble -- "Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin "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," Byrne 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." |
Scott Newman <scott69@gmail.com>: Jul 15 03:35PM +0200 Your thoughts are really great. I'd like to see more posts like this here. |
"Öö Tiib" <ootiib@hot.ee>: Jul 15 06:58AM -0700 On Wednesday, 15 July 2020 16:35:30 UTC+3, Scott Newman wrote: > Your thoughts are really great. > I'd like to see more posts like this here. There are lot of posts from that ramine in comp.programming so go enjoy these there. Here no one reads that trash. |
Scott Newman <scott69@gmail.com>: Jul 15 04:23PM +0200 >> I'd like to see more posts like this here. > There are lot of posts from that ramine in comp.programming so go > enjoy these there. Here no one reads that trash. I think there are few exceptions. Most people surely like his posts. |
"Öö Tiib" <ootiib@hot.ee>: Jul 15 07:38AM -0700 On Wednesday, 15 July 2020 17:23:25 UTC+3, Scott Newman wrote: > > There are lot of posts from that ramine in comp.programming so go > > enjoy these there. Here no one reads that trash. > I think there are few exceptions. Most people surely like his posts. It is apparent that you also do not read postings of that poor guy. Lying to or joking about evidently mentally challenged people is generally considered cruel. |
Scott Newman <scott69@gmail.com>: Jul 15 05:39PM +0200 > It is apparent that you also do not read postings of that > poor guy. ... Like most people I do read his postings. And because I read them I like them like most people. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jul 15 05:02PM +0100 On 15/07/2020 15:38, Öö Tiib wrote: > It is apparent that you also do not read postings of that > poor guy. Lying to or joking about evidently mentally challenged > people is generally considered cruel. Don't feed the troll. /Flibble -- "Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin "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," Byrne 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." |
Juha Nieminen <nospam@thanks.invalid>: Jul 15 05:23AM >>structure is not known. I explained in detail why that's an incorrect >>assertion. > Its not, you're simply an idiot or a troll. Or maybe both. Unfortunately for you, you can't remove your posts from the server. On 7th of July you wrote this: > The class memory layout has to be stored in some form somewhere in the binary > otherwise on the fly objects could never be created. I explained in detail why that's not always the case, and now you are pretending that that's not what you said. And like a petulant child, you just throw insults like a monkey throws feces. I see exactly what you are doing. It's useless to keep pretending. |
Ian Collins <ian-news@hotmail.com>: Jul 15 05:45PM +1200 On 15/07/2020 17:23, Juha Nieminen wrote: > pretending that that's not what you said. And like a petulant child, > you just throw insults like a monkey throws feces. > I see exactly what you are doing. It's useless to keep pretending. Trolling you! -- Ian. |
boltar@nowhere.co.uk: Jul 15 07:56AM On Tue, 14 Jul 2020 17:02:19 +0100 >identical binary as another piece of source code without any classes at all >then please kindly explain how it can possibly be true that class layout >information is stored in the binary? Take all the time you need. Sorry, what the fuck are you talking about? Some compilers convert hard coded floating point ops to integer ops. Does that mean the values of the floats arn't stored in the binary in some form? No wonder you and Hodgin were always arguing, it was just Dumb and Dumber having a family dispute. |
boltar@nowhere.co.uk: Jul 15 07:59AM On Tue, 14 Jul 2020 09:52:35 -0700 >> assertion. >[...] >boltar's posts are unworthy of my response, but I will comment on the Why's that then? >} >its z member is written and read. The generated code depends >on the size of foo (say, 12 bytes) and the size and offset of z Well done. >(say, 4 bytes at offset 8). It doesn't depend on any information Congratulations. >about x or y. So examining the binary might not tell you that z >is the third member, or anything about the first two. It might be I never said the binary stored the types or names, i said the STRUCTURE. >to access obj.z might use, say, an offset from the frame pointer >without any reference to the fact that obj.z is a struct member. So what? >All the executable has to do is implement the visible *behavior* >of the program. A lot of information can be lost during compilation. Yes, but NOT the memory layout WHICH IS MY FUCKING POINT! You know, if you people can't even understand something this basic what chance have you got discussing any serious C++ topics? |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jul 15 09:04AM +0100 > Sorry, what the fuck are you talking about? Some compilers convert hard coded > floating point ops to integer ops. Does that mean the values of the floats arn't > stored in the binary in some form? Correct. > No wonder you and Hodgin were always arguing, it was just Dumb and Dumber > having a family dispute. You have no argument which is unsurprising as you are a fucking idiot. /Flibble -- "Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin "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," Byrne 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." |
boltar@nowhere.co.uk: Jul 15 08:09AM On Wed, 15 Jul 2020 09:04:29 +0100 >arn't >> stored in the binary in some form? >Correct. Oh, so you accept the floats are stored IN SOME FORM in the binary but not the class memory layout? Riiiight. Well there's consistency for you. >> No wonder you and Hodgin were always arguing, it was just Dumb and Dumber >> having a family dispute. >You have no argument which is unsurprising as you are a fucking idiot. Says the man who can't even understand it. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jul 15 10:59AM +0100 >> Correct. > Oh, so you accept the floats are stored IN SOME FORM in the binary but not > the class memory layout? Riiiight. Well there's consistency for you. My reply was "correct" not "incorrect"; learn to fucking read you moron. >>> having a family dispute. >> You have no argument which is unsurprising as you are a fucking idiot. > Says the man who can't even understand it. That would be a classic case of projection, dear. /Flibble -- "Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin "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," Byrne 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." |
boltar@nowhere.co.uk: Jul 15 03:25PM On Wed, 15 Jul 2020 10:59:07 +0100 >> Oh, so you accept the floats are stored IN SOME FORM in the binary but not >> the class memory layout? Riiiight. Well there's consistency for you. >My reply was "correct" not "incorrect"; learn to fucking read you moron. My mistake. I didn't realise you were that ignorant, I should have realised. So if the float value isn't stored in reversable form how is the correct result produced? Go away and think about it "dear". I'm beginning to wonder if you have any grasp of how computers work beneath the language level. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jul 15 05:01PM +0100 > result produced? Go away and think about it "dear". > I'm beginning to wonder if you have any grasp of how computers work beneath > the language level. I'm beginning to wonder if I have ever met such a poor excuse for a troll; I am also wondering if you aren't actually trolling but you really are that stupid. /Flibble -- "Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin "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," Byrne 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." |
Scott Newman <scott69@gmail.com>: Jul 15 05:41PM +0200 > And i will soon provide you with a Lock-free Hashtable > and a Lock-free Skiplist. Please post these algorithms here, even if they're in Pascal. That's while they can be easily ported to C++. |
Juha Nieminen <nospam@thanks.invalid>: Jul 15 05:25AM > my tools to detect its usage and marking as misuse just added > pointless work for no gain. Who forced you to do that, other than yourself? |
Ian Collins <ian-news@hotmail.com>: Jul 15 05:51PM +1200 On 15/07/2020 01:03, Öö Tiib wrote: >> an 'if' statement. However, if the situation ever arises where that's >> the handiest and most convenient thing to do, the feature is there. > I do not find any place in my code where it is handy. Scope limitation? if( const auto it {tests.find(key)}; it != tests.end() ) { // do something with the iterator; } That was from some code I'm currently working on. -- Ian. |
"Öö Tiib" <ootiib@hot.ee>: Jul 14 11:42PM -0700 On Wednesday, 15 July 2020 08:25:50 UTC+3, Juha Nieminen wrote: > > my tools to detect its usage and marking as misuse just added > > pointless work for no gain. > Who forced you to do that, other than yourself? Nothing. It feels to be pointless like rvalue reference to const argument. Rvalue reference to const may be useful in rare case that I do not have in actual code and declaring variables in switch or if may be useful in rare case that I do not even know of. |
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Jul 14 10:35PM -0700 On 7/8/2020 12:41 AM, David Brown wrote: >> Holy Moly! One vs the Other. Well, thats fair. ;^) > Again - /please/ stop feeding the trolls - both of them. (And you are > quickly joining that category.) [...] Damn. |
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