293
Comments
  • 4
    Doesn't seem like something he'd say, C++ is everything but easy to use..
  • 4
    @matanl never understood why people say that oO
  • 3
    Haha, I love this guy xD

    @matanl then you're using it the wrong way^^ once you get the hang, it's fairly easy
  • 0
    @Krokoklemme I have 2 years industrial experience with it, still find it much tougher than other languages
  • 0
    @matanl that's weird... May I ask what exactly you think is hard about it? Because I can't really think of anything ._.

    Pointers aren't that hard, templates aren't that hard (tend to be pretty verbose though), memory management isn't hard (easier than Java's IMHO)
  • 2
    @Krokoklemme
    1. string and file manipulation in the "right" way is pretty unintuitive (could never read a file in a non-C way without looking it up on stackoverflow)
    2. move semantics are very probe to mistake
    3. I don't know about you but making my templated program compile well takes more time than a java/python program (or even a C one)
    4. memory management, I again disagree with you, remembering where each variable resides (for example where an object goes when you return it from a function) is not trivial, especially when multithreading
    5. Operator overloading tends to confuse me because it usually has side-effects which I need to remember
    And there are more..
  • 0
    @matanl 1.) Yeah, string manipulation sucks in C++, but it's even worse in C
    And for the files:
    std::ifstream file("myfile.txt");
    std::stringstream s;
    s << file;
    std::string file_content = s.str();

    2.) Never did much with move semantics, admittedly

    3.) That depends on how complex you're making your templated classes/functions, but personally I never had much trouble with them (except when I was learning them)

    4.) It goes to the assigned value, or more specific to the EAX/RAX register

    5.) What side-effects? What types were you using? Never had any trouble with that either

    To be fair: I don't have any business experience with it, therefore we probably made different things anyway.
  • 0
    @Krokoklemme
    1.) I agree about C.. Yesterday I've tried to tokenize a string and it took about 3 nests (if, while, if). In python it would take 1 at most.

    3.) Yeah I mean when they get complex, compiler errors become unreadable

    4.) I meant returning complex and not primitive types, like a full vector.

    5.) Well if you overload an operator, you customize its behavior. Then you need to repeat this customized behavior in head each time you call that operator otherwise your code will be logically wrong and you will not know why.

    And well C++ gets tough when you get into an existing project, more than building one from scratch. Especially when it's full of alien undocumented C++14/17 code
  • 0
    @matanl all your current problems have solutions. But basically, you thought C++ tough when you're trying to do something that you never see outside C++ I guess. Template for exemple like you mentioned (by the way error template are no longer that crazy, and will be easy to read soon). Not sure thats a good idea to start a deep discussion like that here.
  • 0
    @Celes it could be that it's eventually not hard, but the learning curve is shallower definitely
  • 2
    @matanl that point is obviously true, that's because there is so much way of doing the same thing, that you can be easily lost. But that freedom is addictive x) For me at least
  • 0
    @matanl 1) did you use strtok()/strsep() or wrote something own? I think it could be done simpler than if/while/if
  • 1
    @magnusi c++, I used getline(token_str)
  • 1
    @matanl oh so when you said "C.." it meant "C++". I see, thanks for clarifying 😀
  • 1
    @magnusi yeah I edited the C in there and only after 10 minutes I figured out it's not very clear..
  • 1
    @matanl @magnusi I wrote a little parser at school in C (<100 line) using while and shift. C++ is not that much better for that kind of stuff (well except that you can do a lot of things at compile time).
  • 1
    @Celes some guys at my univ wrote a balanced tree data structure which works in compile time, it was nuts
  • 0
    @matanl heh, people have been claiming the preprocessor is Turing complete for ages
  • 0
    @matanl Macro everywhere? I did that for simulate std vector, but that's not really fun to work with that kind of errors x)
  • 2
    @Celes Yea, I think that C is actually quite good for string proceesing, but it requires a different mindset than languages like C#, Python etc
  • 0
    @Celes I have no idea how they did that though, seems like a code which has to be right on the first time
  • 0
    @matanl it was in C or C++?
  • 0
    @Celes I think recursive C++ templates
  • 0
    @matanl yes with C++ it can be done 'easily' , boost hana made a great work on this ^^ well still no binary tree in the library so far thought.
Add Comment