No announcement yet.

John Carmack's Comments On C/C++

  • Filter
  • Time
  • Show
Clear All
new posts

  • #61
    Originally posted by BO$$ View Post
    Sometimes I wonder why don't more people use C# or Java especially since most don't write performance critical code. And since for high frequency trading some companies use Java I think that you can even choose it for performance critical code. So what's not to like? Faster development, less bugs, better debugging.... I think people choose C++ just to show off.
    There are many bad or/and lazy Java and C# programers, which write slow and buggy code. I think every programer should know some assembly and C.


    • #62
      Originally posted by susikala View Post
      Overall, I believe the discussion about which programming language is better and specifically spending time on discussing to which extent constants or likewise should be used or not is pointless. Most programming languages are the same and the differences are mostly, in my opinion, a question of personal preference and a lot of ego.

      What I actually think one of the overlooked sides of many languages is intuitivity. If you're already designing a high-level language which is meant to be used by humans, why not do it right? Many languages are just horribly not intuitive in really bad and broken ways and that makes them bad languages. Of course, what is intuitive to one person may be completely arbitrary to someone else and that may be the reason why some languages have made such bad decisions, but take Java for example:

      Why should, when considering,
      String one, two;
      // User inputs two strings, both are "number"

      This evolve to false?
      one == two;

      In which cases does it make sense to check if two String objects are the same object? In which of the countless cases where a comparison of two strings of characters is involved would you not be interested in testing for character equality? Why should I be forced to use something so ugly as one.equals(two)? That makes absolutely no sense. Of course, if you treat Strings as non-scalars, and if you define the equal operator to work the same on all objects, you could claim you're only being consistent. But is that intuitive? Would someone who learned that 5 == 5 is true ever think that the above example with the strings should evaluate to false? What is the point in deciding to hide away the arraylike/char pointer nature of a C "string" in introducing a proper String object in java, but then keeping the old garbage by forcing you to use an object method for comparison? How dumb is that?

      There are similar examples in PHP for why intuitivity is so important, and why lack thereof makes a language so bad.
      I think the best way to do it would be this:

      if both string arguments are pooled (ie. immutable) --> compare by reference
      if either of the string arguments are not pooled --> compare by character equality

      Does any language do it like this, and if not, why? Comparing by reference obviously has a speed benefit, but it's useless when the strings (or one of them) aren't pooled. Conversely, comparing by characters is needless overhead when the strings are pooled. This would to me seem to be the obvious solution.


      • #63
        Don't put immutable with pooled.
        You might make someone think pooled means the same as immutable.

        (immutable strings can also exist not pooled)

        Your point of useless when strings are not pooled is the best point about the string equality checks debate I ever read.
        (Same counts for equality of objects though.)
        Last edited by plonoma; 17 January 2013, 10:44 AM. Reason: added point about objects


        • #64
          John Carmack's applauds D language

          John Carmack as already said that D is a good language for new code as here:

          Originally posted by John Carmack's
          Using D for my daily work is not an option, but I applaud thier inclusion of a "pure" attribute.

          But for old code like has John Carmack they are no way to move that is a little too big.


          • #65
            Originally posted by plonoma View Post
            Don't put immutable with pooled.
            You might make someone think pooled means the same as immutable.
            Yes, immutable is not necessarily pooled, I just meant that a pooled string usually is immutable.


            • #66
              As i already said D is better choice when starting a new code otherwise depend which size is your project.

              John Carmack's project are to big to move in another language

              Originally posted by John Carmack
              Using D for my daily work is not an option, but I applaud thier inclusion of a "pure" attribute.