C++ is an awful candidate for a first programming language to learn, at least nowadays - it is very powerful, but it’s also full of foot-guns and past a certain point the learning curve becomes a wall
Pointers are almost always a bad idea - but you’ll probably get a lot of mileage out of having a handful of them in a large project… there’s an impulse with new C++ devs to do everything with pointers and use complex pointer arithmetic to do weird array offset and abuse predictable layouts to access stack variables etc… pointers are fine when used with moderation.
Basic C++ isn’t really confusing (if you are not handwriting makefiles). It starts to get fucky when you get into memory handling, templates, etc. I’m assuming they are only using C++ over C for basic OOP (class/structs inheritance etc).
it’s a great candidate. It was my first “real” languages (i.e. the first language, that is not php/js)
you have a text file. then call the compiler on it, and then you have a exe file, that you can run. It does exactly what it is supposed to do without thinking about the browser, the webserver, the JVM, or some other weirdness.
I get, that doing “good cpp” is difficult. And using all the weird languages features is difficult. But as long as you use strings, ints, ifs, fors, you should be fine. Just don’t use generics, templates, new (keep everything on the stack), multi-inheritance, complex libraries, and it’s a nice beginner language.
Yeah. My intro programming classes used C and C++ and they were great for illustrating the fundamentals. Plus I think it’s important to learn the building-blocks/history
this std::cout << "hello world" bullshit is in no way intuitive. You’re using the bit-shift operator to output stuff to the console? WTF? Why 2 colons? What is cout? And then these guys go on to complain about JS being weird…
No, C is where it’s at: printf("hello world"); is just a function call, like all the other things you do in C.
For non-programmers (who most definitelly don’t know that >> and << are bit shift operators) shoving something into something else is more intuitive than “calling a function with parameters”.
Also don’t get me started on the unintuitiveness of first passing a string were text is mixed with funny codes sgnaling the places were values are going to be placed, with the values passed afterwards, as opposed to just “shove some text into stdout, then shove a value into stdout, then shove some more text into it”.
Absolutelly, once you are used to it, the “template” style of printf makes sense (plus is naturally well-suited for reuse), but when first exposed to it people don’t really have any real life parallels of stituations were one first makes the final picture but leaving some holes in it and later fills-in the holes with actual values - because in real life one typically does it all at once, at most by incremental composition such as in C++, not by templating - so that style is not intuitive.
C is no beginner heaven either, printf is its own can of “why can this function have any number of arguments and why does the compiler have to complain about the formatting every 25 milliseconds” worms
C++ is still the far and ahead leader in game programming. All the tools are written in it and everyone is used to it.
C++ is an awful candidate for a first programming language to learn, at least nowadays - it is very powerful, but it’s also full of foot-guns and past a certain point the learning curve becomes a wall
Not really. Pointers are almost always a bad idea - just use const refs and you’ll be fine.
If using pointers is out of the question, then why choose to learn a language with explicit memory access before anything else?
I have yet to learn Rust, but from what I hear it’s simpler and (mostly?) memory-safe – implying that it’s generally a better first language to learn.
Pointers are almost always a bad idea - but you’ll probably get a lot of mileage out of having a handful of them in a large project… there’s an impulse with new C++ devs to do everything with pointers and use complex pointer arithmetic to do weird array offset and abuse predictable layouts to access stack variables etc… pointers are fine when used with moderation.
What do you mean? Pointers are the best thing ever. It either works, or you manage to make fireworks!
Basic C++ isn’t really confusing (if you are not handwriting makefiles). It starts to get fucky when you get into memory handling, templates, etc. I’m assuming they are only using C++ over C for basic OOP (class/structs inheritance etc).
deleted by creator
it’s a great candidate. It was my first “real” languages (i.e. the first language, that is not php/js)
you have a text file. then call the compiler on it, and then you have a exe file, that you can run. It does exactly what it is supposed to do without thinking about the browser, the webserver, the JVM, or some other weirdness.
I get, that doing “good cpp” is difficult. And using all the weird languages features is difficult. But as long as you use strings, ints, ifs, fors, you should be fine. Just don’t use generics, templates, new (keep everything on the stack), multi-inheritance, complex libraries, and it’s a nice beginner language.
Yeah. My intro programming classes used C and C++ and they were great for illustrating the fundamentals. Plus I think it’s important to learn the building-blocks/history
Maybe it’s C that’s a good first language, though I would admit that the basic ouputting of values to stdout is more intutive in C++.
this
std::cout << "hello world"
bullshit is in no way intuitive. You’re using the bit-shift operator to output stuff to the console? WTF? Why 2 colons? What is cout? And then these guys go on to complain about JS being weird…No, C is where it’s at:
printf("hello world");
is just a function call, like all the other things you do in C.For non-programmers (who most definitelly don’t know that >> and << are bit shift operators) shoving something into something else is more intuitive than “calling a function with parameters”.
Also don’t get me started on the unintuitiveness of first passing a string were text is mixed with funny codes sgnaling the places were values are going to be placed, with the values passed afterwards, as opposed to just “shove some text into stdout, then shove a value into stdout, then shove some more text into it”.
Absolutelly, once you are used to it, the “template” style of printf makes sense (plus is naturally well-suited for reuse), but when first exposed to it people don’t really have any real life parallels of stituations were one first makes the final picture but leaving some holes in it and later fills-in the holes with actual values - because in real life one typically does it all at once, at most by incremental composition such as in C++, not by templating - so that style is not intuitive.
C is no beginner heaven either,
printf
is its own can of “why can this function have any number of arguments and why does the compiler have to complain about the formatting every 25 milliseconds” worms