text: 68
  Joined
  Last visited
  Community Reputation6069 Excellent
  About Oberon_Command
  - RankContributor
  C++
  Oberon_Command replied to Finalspace's topic in General and Gameplay ProgrammingIt seems to me that people are talking at cross-purposes here. One camp is insisting that the standard allows for you to use enums for bit flags (and furthermore, that this is conventional) while the other camp is arguing that you shouldn't do that (regardless of whether or not it's conventional) and that the behaviour is only in the standard to support legacy code. "Can" vs "should." I don't see anyone denying that enums have been used for bit flags, only that we should use them for bit flags. I certainly don't see any bullying here. Bullying would involve personal attacks, and I haven't seen any so far. Pointing out that someone is doing something practicible, but dangerous or confusing or just non-preferable, is not bullying. In support of the "you shouldn't do that" camp: Very few compilers adhere precisely to the standard. It's not unheard of for compilers to make non-standard optimizations and subtly different behaviour between compilers is not unheard of even when the compilers aren't optimizing. See Hodgman's examples. Using enumerations for bit flags dilutes their meaning; you're taking something meant for one thing and re-purposing it to do something else. A similar argument has been made against the use of exceptions for control flow (at least in C++). It has been claimed that the use of enums for bit fields is "going out of fashion", meaning later generations of programmers reading your code won't think much of code that does this and may be actively confused by it. In C++, alternatives exist (like std::bitset and constants in a namespace). It may be true that the standard allows us to use unscoped enums as bit flags, but being allowed to do something isn't an argument for doing it.
  Oberon_Command replied to MarcusAseth's topic in For BeginnersSorry, I should have been more clear - try using SetWindowLongPtr to attach the pointer to the D3DApp to the window. Attaching the method will not help you because you would still need the D3DApp instance to call it properly. In your wndproc you can retrieve the pointer, cast it to a D3DApp, and call the virtual function on it, just as you are with the global.
  C++
  Oberon_Command replied to Finalspace's topic in General and Gameplay Programming1. std::bitset is specialized on the number of bits it can support. At the very least, the type system will prevent you from assigning incompatible bitsets. If you wanted more type safety on top of that, you could have a wrapper structure (or typedef) that takes both the bitflag enum type and the number of bits as template arguments, making the enum part of the type, but getting the convenient interface of bitset. 2. That seems suboptimal and I would be curious as to the reasoning. You can construct the bitset with an initial value, either by passing the initial value as an integer type or as a string (which it will parse). Surprisingly and somewhat annoyingly, it doesn't appear there's a way to pass in an initializer list of the flags, but you could easily write a function that builds a raw bitset from a list of flags. See the cppreference link I posted above for std::bitset for more info.
  C++
  Oberon_Command replied to Finalspace's topic in General and Gameplay ProgrammingWhy use enums for flag values when you can use a regular enum with std::bitset, and have code that is much clearer? Then you don't have to think about any of this. enum FlagBit { Bit0 = 0, Bit1, Count }; std::bitset<FlagBit::Count> bits; bits.set(FlagBit::Bit0); printf("%d", bits.count());
  Oberon_Command replied to MarcusAseth's topic in For Beginners...
  C++
  Oberon_Command replied to Finalspace's topic in General and Gameplay ProgrammingIf you want to use enumeration values to refer to bits, is there any particular reason you aren't using std::bitset, which is specifically designed for this sort of thing? Also, it is only "scoped" enums (enum classes, in other words) which have an underlying type of int unless otherwise specified. The unnamed, unscoped enums in this thread are not scoped, therefore this does not apply to them. Instead, section 10.2.5 specifies that the underlying type is the type of the first assigned expression to the enum, or an unspecified integral type wide enough to contain the largest value (if such a type exists, otherwise the program is malformed). Also, that "if the underlying type is fixed" part is important. The underlying type is only fixed if a) the underlying type is explicitly specified or b) the enum is scoped (in which case it defaults to int). Paragraph 10.2.7 says:  0." I'll grant you that 10.2.8 does say that unfixed type enumerations can hold values that are not defined by any of the enumerators, but... std::bitset, anyone?
  Oberon_Command replied to Wysardry's topic in General and Gameplay ProgrammingCheck out FreeBASIC:
  Oberon_Command replied to polyfrag's topic in GDNet LoungeBeing at work and spending all your time compiling your code is a joke...
  Oberon_Command replied to Alpha_ProgDes's topic in GDNet LoungeBecause clearly, attractive women cannot possibly just be actual pedophiles...
  Oberon_Command replied to grumpyOldDude's topic in GDNet LoungeThe hell? No, that's not what that means. None of us are responsible for the actions of our predecessors, but we are responsible for how we respond to the society they created - whether we perpetuate the systems they left us with or change them to be more inclusive. One should not ignore history when making decisions of how to treat people. It would be nice if that were possible, and we should work towards a future where it is, but the wounds are still too fresh. It isn't merely a shadow, there are still echoes of the bad shit in today's society. THAT is what all this talk about institutionalized racism is about. So, what do you suggest as a "centrist solution" to address the problem of intergenerational trauma? An example of that on the Canadian side of the border would be the residential schools and the fallout therefrom.
  Oberon_Command replied to grumpyOldDude's topic in GDNet LoungeJust because they're "popular", doesn't mean they always report things properly. Some nuance is often lost. There's incentive to report on the most sensational thing in a sensational way. For example, the Lara Witt article is just pointing out that somebody said something that sounds sensational; it doesn't even try to explain why she might have said any of the things she said, it purely focuses on the optics of what she said and then editorializes thereon. I'd hardly call that "journalism" at all. In fact, on the note of popularity, who the hell is "PJMedia"? The "end of white america" refers to the end of America being defined by "whiteness," not the end of white people existing in America. The article actually says this in its subtitle. Much of the "white people are evil/whiteness is evil" stuff isn't talking about actual people, but "whiteness" as an identity. If someone's talking about identity politics, don't be surprised when the things they say don't make sense outside the context of identity politics. Many of these headlines come from academics using words in ways that aren't extreme at all in context, but seem so when taken out of context. The high school teacher who said that "white people are all racist" was clearly talking about institutional/cultural racism, not individual bigotry - an idea the article actually refers to. The only reason this is news is some offended students who didn't understand what he was actually talking about. Now that I actually get to it, I'm not confident that you actually read your own links and thought critically about them, and I suspect you just picked them based on their headlines (and only looked at the headlines).
  Oberon_Command replied to grumpyOldDude's topic in GDNet LoungeI think Hodg's reaction (which is also my own) is that Wav has drastically oversimplified things to the point that what Wav said isn't actually a meaningful representation of any position. No, the Left is NOT telling us that "how one gender and one demographic is the fount of all that is wrong with society." The actual position is more along the lines of, "for historical reasons, one particular demographic currently has more advantages and power in the aggregate than the others. This is a bad thing (for a bunch of reasons), so we should make that not a thing anymore and if you happen to be in that demographic, be mindful of how you use your privilege and how your actions come across to those with less privilege than you, and if you don't do that, you're perpetuating the fallout of the bad shit that happened back in the day and making life harder for everyone else." Of course, it IS true that most of the objectionable shit the "Left" (in North America at least) is talking about ultimately happened because of European colonialism and there's a lot of resentment there, but one just can't simplify that to "WHITE MEN BAD," and the people who are doing that are either letting their resentment and anger get the better of them or seeking to caricature the real position.
  Oberon_Command replied to grumpyOldDude's topic in GDNet LoungeHoly fuck, no. That will NOT end ISIS overnight. It would be like bombing the Vatican in response to the Irish Republican Army. It would only aggravate the 1.6 billion Muslims worldwide, turn them against us, and lead to even more conflict. The extraordinary measures of addressing the fact that some people feel alienated and purposeless in a changing, hostile world? Actually, that would be kind of extraordinary.
  Oberon_Command replied to grumpyOldDude's topic in GDNet LoungeAre you serious? What about all the abortion clinic attacks that have happened over the years? What about the Charleston attack? All the school shootings? And that's just in the US. In Canada we had this guy: I'm not saying it's sufficient. Only that authoritarian measures are not going to help and that ostracizing some segments of society will only drive them closer to radicalism. You swing to authoritarianism because of ISIS, and you are dancing to the tune they're playing and not your own. And as for the status quo, how many people die a year in terrorist acts vs. how many people a year in car crashes? I mean, last time I looked, more people die in car accidents per year than in airplane crashes, so I'm pretty sure which way that comparison would go... The WWII analogy is crap IMO. The Japanese were an empire. They had an official navy, air force, and army. Their combatants were uniformed. They had a country to defend and the strength to invade other nations and subjugate them. Last time I checked, ISIS and friends are not defending a country. They are not an empire. They're a bunch of dirty deluded dudes who shoot people and hide like cowards among innocent civilians, daring us to kill them all and sacrifice our principle that innocent people shouldn't suffer. Do people really think most of the people who live in ISIS territory actually support the militants? ISIS is really bad for the people who are living under their sway, of course, but here in the West, what power do they have? Even the latest attack was just some guys rolling a truck around and stabbing people. Basically a glorified, sensationalized car accident. That's... kind of unimpressive by WWII standards. My respects to your veteran friend, but what applied in 1945 to Imperial Japan does not necessarily apply in 2017 to ISIS and friends. We don't need to repeat mid-20th century atrocities.
  Oberon_Command replied to grumpyOldDude's topic in GDNet LoungeSo what? There are a lot of people you can't reason with. People you can't reason with have always existed. Why should we compromise our values because people who don't share them are angry at us? So, basically what I'm seeing here is that you're putting words in the mouths of the people who lost loved ones, without actually being onesuch yourself, to support a position you've yet to meaningfully back up any other way than appeal to fear. Okay then. Really? And what about how supporting going all authoritarian is supporting some segment of the innocent populace suffering under the boot of the government (in this case, mostly people who look middle-eastern)... 1. This is contrary to Western values. 2. What's to stop people from lying? 3. A candidate recently ran in Canada with a platform that included this. She was widely mocked and was not elected leader of her party. 4. Therefore, I am incredibly doubtful that this is politically feasible or even practicible. Not going to happen. This and basically every other suggestion you've made would drive more people towards radicalization.