Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

1107 Excellent

About Nitage

  • Rank
  1. Nitage

    Criticism of C++

      I couldn't disagree more with that line of argument. A very common weakness of GC'd languages is a lack of robust facilities for managing resources other than memory. In my opinion, RAII is the gold standard for resources management.
  2.   As a general principle: where the option exists to use functionality that's been written by domain experts and has been extensively tested in the real world, you should strongly prefer that over your own code.
  3. Nitage

    C++ dynamic_cast

      Am I missing something here? A pointer/reference to a derived class should implicitly convert to a pointer/reference to a base class, so a simple assignment should do and dynamic_cast isn't necessary.
  4.   You listed some requirements in your original post. The purpose of switching language is to satisfy those requirements, nothing more.   So the real question is why would you not switch to a language that meets your requirements only because that language offers other functionality that you don't intend on using?
  5. I like Ada's version, where the header contains only the interface. Not so much the C/C++ version where the decision of what goes into the header file isn't logical, but is instead a consequence of technical details regarding translation units.
  6.   I'm not going to say that you're crazy, but what you're doing is throwing out good solutions because they aren't perfect.   Almost everything you've asked for can be achieved by using C compiled as C++ with a few whitelisted C++ features. For example, your issue with member function pointers not being automatically tied to an object instance can be solved by using a template function that uses `std::bind` internally. You can then ban all other uses of template functions or std::bind, or any of the other C++ features you dislike. Basically, it seems you want C with a bit of extra syntactic sugar. You can get that from C++.   The same goes for Go, D and Rust - any one of them meets your basic requirements. It seems like you're just seeking out reasons not to use them rather than having genuine requirements that preclude their use.     If that's true - that this "flaw" kept you from even considering C++ - then you've made a mistake. Your statement that you "Cannot set a callback on a member function"and that it's "impossible in the base C++ language" is just false and you've thrown out a potential solution due to a misconception.
  7. Nitage

    D language enum question

    That's an anonymous enum with a single member which is an array of arrays of strings.   Its C++ equivalent is:   constexpr const char* logTypes[2][2] = {   {"red"       , "color"},   {"blue"       , "color2"}, };
  8. Nitage

    C++ compile times

    The dominating reason for slow times is the preprocessor, no question. The preprocessors #include directive can mean compiling a 100 line file requires processing several orders of magnitude more code, and #if... directives make it very hard to cache the results of processing a file. There are also other issues; C++ compilers do more than C# ones. Some parts of C# compilation are deferred until runtime (JIT) and the Microsoft C# compiler doesn't optimize nearly as aggressively as their C++ compiler or g++. For example, it doesn't ever perform tail call optimization (there's a IL 'tail' instruction which the F# compiler emits, but the C# one doesn't). This is minor in comparison to the preprocessor issue though.
  9. i = j * 5; … in C you know, at least, that j is being multiplied by five and the results stored in i. But if you see that same snippet of code in C++, you don’t know anything. Nothing.... [/quote] I've read the Joel article several times before and have never found it convincing. The alternative to operator overloading for 'j *5;' is 'multiply(j,5);'. Now, if you write a binary operator* that doesn't multiply you are an idiot, but no more of an idiot than if you'd written a function called 'multiply' that doesn't multiply.
  10. You don't need to use the ref keyword at all, seeing as you're not assigning to the bne parameter. Also, keep in mind that in C# parameters of a class type are automatically passed by reference and using the ref keyword creates a reference to a reference.
  11. Nitage

    c++: std::erase, std::unique

    Ok, so what's the solution? Iterate each element and do erase+unique?[/quote] [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]No, just use the two parameter version of erase.[/font] [color=#000000]myFullHair.erase(std::unique(myFullHair.begin(), myFullHair.end(), compareMat),myFullHair.end());
  12. Nitage

    comparing company names

    It's relatively simple to match a string against a predefined set of synonyms. If you are aiming to do this procedurally (i.e. by guessing which strings are synonymous) then you're on a fools' errand.
  13. High quality, clean, well tested and documented code can gain value very quickly. ... So in conclusion, yes I think that easy decompilation is a major concern with managed languages. There is no perfect solution to this problem as of yet (at least not as good as native compilation, which makes code reuse almost impossible). The minimum for any serious project should be obfuscation. [/quote] I agree that high quality code accompanied by good tests and documentation can be valuable - but as decompilation provides neither tests nor documentation, I don't view it as a problem.
  14. [color=#1C2837][size=2][/quote][color=#1C2837][size=2]Halving your productivity but preventing someone from taking your distribution verbatim, reverse engineering it (automated) and releasing their own modified version in 2 hours is a good trade-off.[/quote] [color=#1C2837][size=2] [color=#1C2837][size=2]That depends. If you're halving your productivity to prevent someone from ever reverse engineering your code then it may be a good trade off. [color=#1C2837][size=2]If you're halving your productivity to increase the time taken to reverse engineer your code from 2 hours to 8 hours, then it's likely not. [color=#1C2837][size=2] [color="#1c2837"]Like DRM, obfuscation merely increases the effort an attacker has to put in - and like DRM it's mathematically flawed and requires orders of magnitude more effort to implement than to break.
  15. Nitage

    Help with optimizations

    The best algorithmic complexity you can achieve is O(n) space, O(n) time (a counting sort). If you want O(1) space you'll have to settle for O(nlogn) time (an inplace O(nlogn) comparison sort). The fastest way depends on the size of your data set and the implementations of the contained types copy constructors, move constructors and swap functions.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!