So many things to learn, so little time.
I don’t know why I do this, maybe because I am curious or interested in making lots of different kinds of things - from games, to art and music. I am interested in how things work, and I can easily get lost in concentration as I investigate further, drawing paralleles with my existing understanding. In any case, I keep finding myself with lots to learn and not enough time to learn it.
Whenever start learning something new, it seems I am already learning a few other things. Learning C++ is the latest thing, even if I only intend to get a beginner level at the moment.
I am also learning Unity, Blender, Ableton Live, C#, Digital Illustration, Irish traditional music on bousouki… you see what I mean!
Regarding game development, I’ve recently been learning Unity. Unity uses C# for its scripting. C# is new to me, and I don’t have experience in Java to help me grok it. I’ve been teaching myself C# using some TeamTreehouse online courses, and that’s been great so far. C++ is not C#. So why bother learning that too? Let me explain.
My latest game dev project is largest one yet. The scope of it has required me to up my programming skills, since larger projects demand a different approach. Becoming better acquainted with systems programming languages and strongly typed languages is one thing, designing and implementing a modest project in clean code is another.
Tutorials and books on the subject of game dev often use C++ as a reference language in their examples. Understanding such examples line-by-line can be a little confusing if an example relies on C++ specific keywords or statements. Learning C++ would likely help.
While I mostly comprehend the examples in texts I’ve come across, I occasionally encounter C++ keywords and features that I have not directly experienced in my everyday scripting language use. Without a solid frame of reference to translate the meaning of the example code in my head, I must think abstractly about the source code in addition to the programming concept demonstrated in the example.
Generally this is not a big deal, I can infer useful meaning by the context of the accompanying text. However, it slows me down and the potential for misunderstanding has recently come to frustrate me. I would rather immediately understand what is happening from having a solid foundation of understanding of C++.
Having stumbled across a few such problems in quick succession, I have finally decided to start learning C++.
Where to start learning C++?
I’m using Windows 10 but I’ll be using Windows Subsystem for Linux with Ubuntu 18.04 and setting up Visual Studio Code to edit using the Remote connection feature. I’ve installed a gcc compiler on WSL and hooked everything up. This tutorial helped a lot to get it all hooked up without issue: https://code.visualstudio.com/docs/cpp/config-wsl
I can’t wait to get into the more object oriented side of things with C++. That is my big blindspot with the language. I don’t actually care to take on the object oriented style of programming very much, as I tend to prefer shallow but wide heirarchies in code for sanity and maintainability. The specifics are important though. Armed with that knowledge who knows what I will do next.
Anyawy, here’s some useful stuff to know already.
Numeric Data Types
I already found this table of Numeric Data a useful resource to help clear up my understanding of the innerworkings. NOTE: The type names that start with a __ character are considered non-standard types.
|int||4||signed||–2,147,483,648 to 2,147,483,647|
|unsigned int||4||unsigned||0 to 4,294,967,295|
|__int8||1||char||-128 to 127|
|unsigned __int8||1||unsigned char||0 to 255|
|__int16||2||short, short int, signed short int||–32,768 to 32,767|
|unsigned __int16||2||unsigned short, unsigned short int||0 to 65,535|
|__int32||4||signed, signed int, int||–2,147,483,648 to 2,147,483,647|
|unsigned __int32||4||unsigned, unsigned int||0 to 4,294,967,295|
|__int64||8||long long, signed long long||–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807|
|unsigned __int64||8||unsigned long long||0 to 18,446,744,073,709,551,615|
|short||2||short int, signed short int||-32,768 to 32,767|
|unsigned short||2||unsigned short int||0 to 65,535|
|long||4||long int, signed long int||–2,147,483,648 to 2,147,483,647|
|unsigned long||4||unsigned long int||0 to 4,294,967,295|
|long long||8||none||–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807|
|unsigned long long||8||none||0 to 18,446,744,073,709,551,615|
|float||4||none||3.4E +/- 38 (7 digits)|
|double||8||none||1.7E +/- 308 (15 digits)|
|long double||8||none||1.7E +/- 308 (15 digits)|
Character Data Types
For internationalization purposes, the wchar_t type is used which expands on the numeric values available to represent character sets from various languages found around the world.
|char||1||none||–128 to 127 by default 0 to 255 when compiled by using /J|
|signed char||1||none||-128 to 127|
|unsigned char||1||none||0 to 255|
|wchar_t, char16_t, and char32_t||2 or 4||__wchar_t||0 to 65,535 (wchar_t & char16_t), 0 to 4,294,967,295 (char32_t)|
Other Data Types
|bool||1||none||true or false|
|enum||varies||none||dependant on the enclosed data types|
Hopefully, gaining C++ knowledge will help me experience a smoother journey in my research of game programming and algorithms. If I enjoy C++, I may even use it in my projects. Time will tell (and I may make a follow up post).
At the time of writing, learncpp.com was temporarily unavailable. Fortunately, it is snapshotted on https://web.archive.org/.