Jump to content
  • Advertisement

BitMaster

Member
  • Content count

    1829
  • Joined

  • Last visited

Community Reputation

8652 Excellent

About BitMaster

  • Rank
    Contributor

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. While I can understand a certain amount of frustration with Kylotan in particular there will always be people who are unhelpful and/or distracting. That said, Hodgman pretty much answered your question in the very first reply of that thread. After that there was only the option of silence or talking about the usefulness of the question. Granted, Kylotan started talking about something completely unwarranted and mixed that in with some valid points but, as I said, that's the way he is and one just needs to learn to deal with that.
  2. BitMaster

    Disable Ubuntu shortcuts

    By setting a global shortcut, I explicitly define that I want to dedicate that key-combination for that particular function. What makes an application believe it can ignore my choice? How do I reach that particular function if it overrides the one connection I have? From what I understand one of the key issues here is not that this is not about me setting but an obnoxious preconfiguration. If this was something you had to explicitly opt in for this whole discussion would be moot, but it is instead something the average user will encounter, not even understanding why the game does not work as intended. Setting that aside, it is very much not uncommon for games to knowingly circumvent some platform behaviors. That is always a thin line to walk but considering games are typically used very differently from normal desktop applications this can be justified.
  3. Then either those are not built correctly as static libraries or something else you are linking pulls in a dynamic OpenSSL dependency. If you changed those dependencies recently it's also possible (though unlikely) that you need to force a complete rebuild of the project. You can also see if you can set the linker to verbose. It should then list every library it is linking and you can verify you are only linking exactly what you expect. Even if you made no mistakes yourself all it takes is a single well-hidden #pragma comment(lib, ...) to screw you over.
  4. That is absolutely not the case. The /MT switch links the static C++ runtime. If you use any 3rd party dependencies you will have to ensure you compile them to static libraries and link to those. Note that getting some libraries to compile in this way can take some knowledge and work since a lot of projects are not intended to be used that way. There are also potentially problematic license issues unless you originally picked your libraries with an eye towards that.
  5. BitMaster

    Different Versions of VS C++.

    Personally I would much rather use something like CMake or Premake to generate my project files. Not only does that eliminate the potential headache when switching to a different version of MSVC I also get additional build environments for several platforms and compilers for free. I haven't had to deal explicitly with an MSVC project file at work for years and it made me a happier person.
  6. BitMaster

    Quick Opaque Pointer Example

    Well, the only thing that really bugged me was the missing alignment check. Mostly because if not for that, I would have used one of the types I used with a bad alignment myself. And then I thought: why not take the opportunity to add your own attempt to the discussion, things like that can always use an extra pair of eyes to look through it. ;)
  7. BitMaster

    Quick Opaque Pointer Example

    I'm not really happy with that. Granted, you static_assert the size but you should also really static_assert the alignment. Personally I also dislike doing that work in your concrete class. Right now, adding a constructor has a relatively high risk of forgetting to initialize the opaque pointer. I have lately been toying around with something like this: template <typename T, std::size_t Length, std::size_t Align = alignof(void*)> class opaque_data { public: /** * The underlying type. */ using type = T; /** * Initializes the underlying data. * @param args any arguments to be passed to the underlying type's * constructor. */ template <typename ... Args> opaque_data(Args&&... args) { static_assert(sizeof(type) <= Length, "not enough storage available"); static_assert(alignof(type) <= Align , "alignment requirements not met"); new (reinterpret_cast<type*>(&storage)) type{std::forward<Args>(args)...}; } /** * Initializes the underlying data using a subclass. * @param args any arguments to be passed to the subclass' constructor. */ template <typename S, typename ... Args> opaque_data(tag<S>, Args&&... args) { static_assert(sizeof(S) <= Length , "not enough storage available"); static_assert(alignof(S) <= Align , "alignment requirements not met"); static_assert(std::is_base_of<type, S>::value , "the specified type is not a subclass of the underlying type"); static_assert(std::has_virtual_destructor<type>::value, "inheritance is used and base underlying type has no virtual destructor"); new (reinterpret_cast<S*>(&storage)) S(std::forward<Args>(args)...); } /** * Destroys the underlying data. */ ~opaque_data() { reinterpret_cast<type*>(&storage)->~type(); } /** * Returns a reference to the underlying data. * @return a reference to the underlying data. */ type& data() { return *reinterpret_cast<type*>(&storage); } /** * Returns a reference to the underlying data. * @return a reference to the underlying data. */ type const& data() const { return *reinterpret_cast<type const*>(&storage); } /** * Swaps the underlying data with another instance. * @param other another instance. */ void swap(opaque_data& other) { using std::swap; swap(data(), other.data()); } /** * Allows access to the underlying type's data members. * @return a pointer to the underlying type. */ type* operator -> () { return reinterpret_cast<type*>(&storage); } /** * Allows access to the underlying type's data members. * @return a pointer to the underlying type. */ type const* operator -> () const { return reinterpret_cast<type const*>(&storage); } /** * Returns a reference to the underlying data. * @return a reference to the underlying data. */ type& operator * () { return data(); } /** * Returns a reference to the underlying data. * @return a reference to the underlying data. */ type const& operator * () const { return data(); } /// @name Deleted Constructors and Operators //@{ opaque_data(opaque_data const&) = delete; opaque_data(opaque_data&&) = delete; opaque_data& operator = (opaque_data const&) = delete; opaque_data& operator = (opaque_data&&) = delete; //@} /** * Swaps the underlying data of two instances. * @param lhs the first participant of the swap. * @param rhs the second participant of the swap. */ friend void swap(opaque_data& lhs, opaque_data& rhs) { lhs.swap(rhs); } private: /** * The storage for the underlying data. */ std::aligned_storage_t<Length, Align> storage; };
  8. BitMaster

    Java - Getting The Path Of The Jar File

    I strongly object to calling an URI "HTML format" or anything similar. The URI scheme is completely unrelated to HTML and used well beyond that domain.
  9. BitMaster

    C++: Custom memory allocation

    If this is implemented via actual polymorphism as shown so far, then ~Allocator must be declared virtual. Aside from that, a lot of the 'work' done in the allocator destructors seems useless. Setting values to 0/nullptr would be at best useful as a debugging help - but the MSVC debug runtime for example would already overwrite the memory immediately afterwards anyway.
  10. I'm not a guy.... >.<
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!