r/GraphicsProgramming • u/pytanko • Jan 18 '24
Not loving C++
How crippling it is for somebody in the field of graphics programming to not love C++? I'm learning C++ right now and really don't like the experience. I wonder how bad it would be for me if I stuck with a very basic subset of C++, closer to C than to modern C++. Does that disqualify me from getting a lot of jobs, even if I'm otherwise competent entry-level graphics programmer?
To put my question in more concrete terms: I'm currently writing a gltf loader (purely as an exercise). As a part of that, I need to parse JSON, so I'm writing a JSON parser as well. Now, I could write the JSON parser using all the modern c++ features, most notably unique_ptr, but passing those unique_ptrs creates a lot of accidential complexity. Notably, I'm constantly getting various compiler errors. I'm muddling through them, but I'm not sureI see the light at the end of the tunnel - C++ spec seems so large that I can see myself still fighting the language even 5 years from now, instead of having fun with it. Whereas, I could skip all that, and just allocate the elements of the Json object tree in a basic memory arena, load whatever I need from the Json into relevant buffers, and then just free the entire arena. That's super-simple memory management approach that is totally sufficient here (I'm not going to ever need to free arbitrary subtrees of the JSON tree), and is something that's advocated by Casey Muratori in his streams.
1
u/Solrax Jan 18 '24
I can sympathize, having done C++ for about 30 years and watching it get more and more complex (or as they call it, "modern"), and having used a bunch of newer languages since then, and now back to doing C++ again. **
But there is something I can advise - if you haven't, take a look at "Effective C++" by Scott Meyers. This book really helps you learn to use and think about C++ correctly. Look for the 3rd edition if you want to get better at the non-modern version, look for "Effective Modern C++" for more guidance on the modern features.
** however, I will confess to liking lambdas and am glad C++ has them now.