Opinions on C++?

What does Jow Forums think of C++ and other coding languages?

I'm just a faggot that wants to program his own game so I set up a compiler on my computer with MinGW Installer, and slowly learning stuff off an online tutorial. really dropped the ball at the different variable types though, I'm too much of a brainlet to understand how their properties differ.

Attached: 512x512bb.jpg (512x512, 19K)

Other urls found in this thread:

stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
e2e.ti.com/support/tools/ccs/f/81/t/668538?Compiler-AM3359-Local-array-unexpectedly-allocated-on-heap-rather-than-stack#
godbolt.org/z/QpjjUl
twitter.com/SFWRedditVideos

I think it would be easier if you learned c first and then moved on to c++.
c++ is basically c with additional complexity.

Any reason you're using MinGW instead of MSVC for Windows, or using GCC on actual linux or WSL?

Also C++ is ok for what it is, but it is veeery bloated. I peronally prefer Vala, which fits the same area more or less. But it is certainly a fine language, and arguably the industry standard for games development, so it's worth using.

don't use MinGW

C# is better to program games with as a solo programmer nowadays. The complexity and nuances of c++ is better suited to larger teams or long-term projects.

also, making a game yourself with c or c++ is incredibly hard and is gonna take you years to learn. I wouldn't recommend going down this path if all you are interested in is making a game (use a game engine and a higher level programming language instead).

If, on the other hand, you are actually interested in programming and how the computer works as well then stay on this path - but just be prepared to spend years learning about stuff before you can make anything yourself.

>dropped the ball at the different variable types
What do you even mean by this?

Attached: 1536996235929.jpg (657x527, 38K)

if you're on spyware 7-10 just be a lazy faggot and use visual studio community edition. if you're on *nix use whatever tf they use there.

in any case get clang installed and use it for testing to make sure you're not doing completely stupid shit e.g. microshit code.

he's not wrong
t. engie dev
it's going to be several actual years of work; much longer if you don't know exactly what you're doing; to build an engine from scratch. If you want something done in a reasonable time frame go use unreal or unity or some cancer like that.

C++ is a very overdesigned language, but you don't have to know 100% of it, and indeed most people only tend to use certain portions anyway.

Attached: C++.jpg (557x800, 193K)

>Any reason you're using MinGW instead of MSVC for Windows
GCC and Clang are lightyears ahead of MSVC. Visual Studio is just a buggy bloated code editor with a compiler that is on par with GCC/Clang circa 2013.

"bloated"
complexity =/= bloat

also wtf is "vala" and how is an industry standard? litereally never heard of it lmao

Oh I 100% agree with that, but you don't need mingw for Clang (and clang works better on windows than gcc iirc). Correct me if im wrong

I said C++ is an industry standard. And vala is like C + classes and a small but usable standard library (it also uses GObjects which makes it integrate well with virtually any other language in existance)

mb misread

c++ is ok
the c++ stl is not

Oh and also
>complexity =/= bloat
Sure, but consider that C++ is getting/has got (i can't remember) operators for webdev. And also, though this doesn't nessisarily contribute to bloat, they needlessly overloaded `std::vector` to be a bitset, which decreases the performance of any programs using a vector of bools by ~70%, when they already had a bitset type.

OP here.

It's mainly just personal preference, it feels nice writing the code in Notepad++ and manually compiling it in Command prompt, it also makes keeping track of my files much easier and I can write and edit everything on the fly. Haven't actually tried Visual Studio for C++ yet, I am gonna switch if I encounter any major limitations on my desktop set up.

I am aware that solo developing a game without a premade engine takes years of work and a huge skillset, but I am not expecting to make a full game anytime soon, for now I just want to learn more about programming and set making a game as a goal. For now I'm just aiming to code something like a platforming engine, I'd consider that a success.

int, bool, char, void, etc.
Apparently they all have different amounts of variable memory and range of possible values, what these are I still need to learn. My skill and knowledge is currently at rock bottom and my low intelligence isn't helping me learn.

>program his own game
Give up, kid. Just use Godot engine and fuck around with it until you commit suicide after realizing game development is too much work for too little gain.

>really dropped the ball at the different variable types though, I'm too much of a brainlet to understand how their properties differ.
The difference between types like int, short, etc. is the number of bits they take up in memory. Bits are binary digits, so more bits = the bigger the numbers they can represent. It's like if you had a base-10 computer that had a 4-digit unsigned integer type, it could hold all the numbers between 0 and 9999, or 10^4-1. Similarly, a 32-bit unsigned integer type can hold the numbers between 0 and 2^32-1.

The difference between signed and unsigned types is that signed types can also represent negative values. The total number of different values a 32-bit signed integer can represent is the same as the number of different values a 32-bit unsigned integer can represent because they have the same number of bits, but signed types have to represent negative values too, so the largest positive 32-bit signed number is roughly half of the largest 32-bit unsigned value (because the other half of the range is taken up by negative numbers). In practice, the range for unsigned 32-bit is 0-2^32-1, while the range for signed is -2^31 to 2^31-1 (this weird range is due to the fact that computers use two's complement).

Booleans can represent true or false (1 bit), but they still take up at least 8 bits (1 byte) due to the fact that the CPU can't address individual bits in memory, only bytes. However, certain implementations of std::vector have optimizations for booleans so a vector of 8000 bools may only take up 8000 bits in memory, instead of taking up 8000 bytes.

C++ veteran here. Using is for 15 years so far.
I use C++ as my primary language because I find it is the best language to express exactly what I mean without any surprises.
People complaining about bloat have no fucking idea what they're talking about. The standard adds features to simplify the language and take advantage of newer compiler techniques and faster machines that make what would have been a difficult to optimize task very cheap.
C++ is a real man's language. There's no "borrow checker" stopping you from doing your work, your way.
The problem with C++ are all the brainlets who try to use it, creating an incomprehensible mess as a result.

>LE BLOAT BLOAD
You don;t need to use all of C++ features

Chars are weird because they are integers that are also used to represent characters. Because of this, the standard doesn't define whether they are signed or unsigned by default (an int or short or whatever would always be signed unless you explicitly declared it unsigned). It is up to the people making the compiler to decide, but (almost?) all compilers make them signed. If you want to make it certain that a char is signed, you can declare it explicitly as signed, like this:
signed char x = 89;

Floating point numbers work similarly to base-10 numbers represented using normalized scientific notation/standard form, only in base-2. In scientific notation, a number is represented in the form m*10^n, where m is a real number between 1 and 10, and n is an integer. This means that there's always one digit before the decimal point, hence the name normalized/standard. If you were designing a base-10 computer, you could create a decimal floating point type where the first 4 digits represent the exponent (n), and the remaining 8 represent the mantissa (m). The number 34750 would then look like this 0003|34750000 (3.475*10^3). If you wanted to represent 9999999999999999999, it would look like this: 0018|99999999. As you can see, we've lost a few digits of precision, but the number is still mostly what we want. floats and doubles work similary, except in base-2, and they are capable of representing negative numbers, or numbers with negative exponents (numbers like 0.00897).
The reason they work like this is that this way you always have the same precision while being able to represent both very big and very small numbers. The alternative would be using fixed-point numbers, numbers that always have the same number of digits after the decimal (with no exponent thing going on), but numbers like that would be very limited. What if you want more digits after the decimal? What if you want really big numbers but you only have 64-bits total?

Attached: file.png (930x179, 12K)

Because floating point numbers are represented using binary, you sometimes encounter rounding errors, where a base-10 number converts to an infinitely repeating number in base-2. It's kinda like how 10/3=3.3333333333... This doesn't really matter unless you're doing scientific calculations/working with money, but it's good to know in case you encounter a situation where your program unexpectedly prints 0.2 as 0.200000001 or something.

Attached: file.png (1241x508, 60K)

sfml/sdl2
a 2d engine wouldn't take long

Best order is probably C -> C# -> Unity (while you can do Unity without coding it will help for writing your own scripts). C# is preferred by unity, thougj knowong C++ will give you 95% of C#. May want to look into DirectX 12 as well.

Im thinking of learning C++ however i have doubts. Ive read alot of comments here and on reddit that if companies look for C++ people then they look for experienced people with masters in speciality and that one year of self learning wont get you a job by just "knowing" c++. It seems true. A company needs programmers in such a low level language and there is no time and resources to spend on teaching them c++, they want ready to go people who will turn productive. So my question is, is it worth to learn c++ considering im a neet with no IT education? Its seem such a programming language where education is needed to get a job

sfml is basically an engine and if you are going to use that then you might as well go all the way and use something like unity or unreal

Pure C is superior

>being too retarded to understand data types
Y I K E S
I
K
E
S

If you want to learn Programming, don't start with games and try to learn everything at once.. go through perhaps a Python course, that will teach you fundamental ideas in a palatable way..

then move on to using Unity with C# , or Unreal with C++. It is important to understand how to write simpler things first and know what the language is doing. Games are the result of hundreds or thousands of scripts running at the same time asynchronously, with graphics, physics, etc etc.. slow down..

Nigga just use Python and pygame or something. You can make release quality games with 1/10th of the headache.

C++ is an immensely powerful language and I've been using it professionally for six years, but part of knowing a language is knowing when not to use it.

Assembler is the best C++/C is for dimwits

Op,
I highly recommend you start by learning logic and psuedo coding first.

If you want to make games it's imperative you don't brute force everything.

It's the best programming language you can learn. The software used by the Large Hadron Collider, the largest and most powerful particle accelerator in the world, was written in C++.

At the assembly level, you don't have signed/unsigned types, just signed/unsigned arithmetic functions. A signed char doesn't make sense and honestly it shouldn't be an arithmetic type

take nand2tetris (free online course) , no
pre -reqs or howtocode simple data on edx

The WORST possible advice. C++ is a different language from C, despite being mostly compatible with it. In C++, you do things a LOT differently than in C.
Learn C++ first. Learn how to do things the C++ way. And then later learn the C parts once you need them. It's the proper way to learn C++ recommended by everyone who knows what they're doing.

Just learn Java and get shit done.

Programming in C++ is like fucking a really cute anime girl, except every word she speaks is prefixed with "std" including her moans, and there's the text "template " floating above her head.
No matter what you do, she seems to always get into really weird positions and if you try to "fix" it she'll throw long somewhat unintelligible and seemingly irrelevant complaints at you. Eventually you give up trying to correct them and just learn to love it, and it turns you on even more now.
The more you're with her the more crazy and amazing positions you discover and things that she'll allow you to do that you never even knew about before, and you just keep going back to her again and again each time going deeper and deeper in both respects of the word until every inch and crevice of her zero-overhead body are filled and covered with your increasingly heavily templated std-ridden code.
Despite all her strange quirks, funny idioms and obvious shortcomings, you've grown to love and adore her, and you _thoroughly_ enjoy using her every night.

Attached: 1555262992943.png (1240x1754, 1.2M)

>Java
Isn't that how they spell C# in Pajeet

Imagine still writing headers in --2020

based++ and cute anime girlpilled

>--2020
>not 2020--

Imagine fucking that cute but weird anime girl, only to share her with idiots who don't know how to use her properly.
They fuck the wrong holes.
They forget to remove her warts on a daily basis.
They make her eat too much data and she gets too fat.
They touch her 10 at a time without proper access hygiene and she ends up with really bad ecchymosis and infections.

Never ever again. Program alone. Use your hand only. It's for your mental and physical health.

>I really dropped the ball at the different variable types though
lmao have fun never making a game in c++. If you seriously want to have at least a shiver of hope on making a game, switch to unity

OP I love the enthusiasm for learning to code, but if you are so new that you don't understand why certain data types have (and need to have) different sizes, I would recommend that you start with a gaming engine and build your platformer from that just for fun and to get your feet wet. What you are wanting to do is something that takes years of practice and you are at such a beginner level (which there is nothing wrong with, welcome to the wonderful world of programming!) I would just recommend picking easier and more attainable goals. Best of luck

>ecchymosis
sounds lewd

I disagree. You'll end up confusing c / c++ conventions because you dont know the difference if you start with c++, whereas if you start with c you will only have the c convention and it'll make it easier to learn c++ afterwards because you can see the differences between the two languages more easily - plus if you start with c++ you'll have to face a bunch of additional language complexities right of the bat which may discourage you.

I disagree. If you start with c++ you will end up confusing c / c++ conventions because you dont know the difference between them, whereas if you start with c you will only have the c convention to worry about and this will make it easier to learn c++ afterwards because you will actually be able to see the difference between the languages - plus if you start with c++ you'll have to face a bunch of additional language complexities right of the bat which may discourage you.

if you don't know C then all of C++'s confusing warts will make no sense

Use VS community and save yourself a lot of trouble. Debuggers are awesome and you might want to look into C# if you find yourself in over your head with sepples.

>It's mainly just personal preference, it feels nice writing the code in Notepad++ and manually compiling it in Command prompt
If you really prefer that I'd recommend getting into Linux and CMake or just Make, if you absolutely must build for windows though VisualStudio can make projects that rely on things like CMake and it's really useful as a debug tool on it's own. I personally prefer linux for C++ as it's just a nicer environment to work in overall from a development perspective provided you're willing to put a bit of time into learning how it all works. If you want to do crossplat stuff just make sure you use libraries that can be cross compiled for both systems.

If you want to get into Linux C++, look into Geany and g++, then make, probably start with a distro like debian or ubuntu.

>Geany
*Qtcreator

Not used it, don't think we should start an IDE arms race tho because it's going to inevitably end in someone running around screaming about EMACS vs Vim

I know reddit have a cpp sub and the often link to the recommended books on stackoverflow.
stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list

Both codeblocks IDE and VS Community edition are free.

I like the D.S Malik book: C++ Programming Program Design Including Data Structures

Bucky's C++ tutorials got me to where I am today, they're literally the bomb. Start with "Buckys C++ Programming Tutorials - 2 - Understanding a Simple C++ Program" user.

C++ is a fine language but difficult to learn. If you're looking to get started with programming, I suggest you have a look at pic related. It's only free at htdp.org

Attached: htdp-2e-cover.gif (419x500, 96K)

C++ is 100% compatible with C. You can write a pure C program in C++. Just because you can do a lot of things differently doesn't mean you have to.

>100% compatible
Not for a long time. Mostly compatible, yes.

char *p = malloc(sizeof *p);
valid in C, not valid in C++

>only
Meant to write 'online'. But nobody here is gonna try it, anyway. What am I doing with my life?

In similar spot, got stroupdop cpp book but not sure if cpp is good first language? Is c sharp better?

>footshit
dropped
guaranteed to be horribly documented, badly designed, and be changed randomly in a way that negatively impacts the end user/developer

While C++ is a good language, it's not a good first language, no.
It also takes like a year or more to actually learn it to the point that you are comfortable with all of intricacies, even if you don't use them, and that's starting with experience.

Fully learning the language itself is impossible, it cannot be comprehended in its entirely, multiple language features have been discovered as opposed to created, such as template metaprogramming, or more recently, compile time state.

Ask a low latency/high frequency programmer anything about the gloriousness of C++

I do low latency programming with VBA lmao
it's just sockets in the end, it only matters if your server/network is fast

I like how you can take a 10+ year old c++ codebase, and with minimal tweaks get it working on modern compilers.

Try doing it with a meme scripting language with fancy package manager and you're more likely to get severely burned.

C++ has been deprecating, removing and changing lots of stuff over the years. sometimes even stuff introduced quite recently.

This. Dont listen to idiots thinking modern C++ is just "C with classes". Learn things the right way.

people don't get that c++ is garbage because it is the best programing language we have.

lets say i have function overload
void f(float)
void f(int)
i can not call variant directly its need a ugly wrapper std::visit thats just proof that cpp17 is broken not because it is not working because it is to complex for no reason. while C is pure it just feels right, but it lacks all modern feature. in 2019 I expect a grow-able-container in any PL. and I hate that c99 does implicit heap allocs.

void c_arr(int s){
this_array_is_heap[s];
this_is_stack[10];
}

Except C doesn't so implicit heap allocations retard that's just alloca

Niggerlicious. Only use ANSI C.

ZERO COST ABSTRACTION
unique amongst the modern language, if you can live with the arcane STL, you gain the benefit of writing fast code as if it was written in plain c while b2inf able to address it like high level obj

The containers library for C++ is really quite shit tbqh

Sasuga Ctard, don't even know your own language that has no features.

yeah thats the price for taking the cpp pill

wrong my friend alloca is non standard and heap vs stack alloc is not part of the standard. GCC does heap alloc for vla but it's loves to unroll them and will crash your app.

e2e.ti.com/support/tools/ccs/f/81/t/668538?Compiler-AM3359-Local-array-unexpectedly-allocated-on-heap-rather-than-stack#

Different programming newb here:

I started out with C++ through Strousoup's Programming Principles and Practice book. Since then I've moved on to using Java and Python to learn programming concepts.

I've always wanted to return to C++, but it's hard to find material published within the last two years (C++17). But there's tons of C++11 stuff out there aimed at beginner-level programmers like myself.

The only thing that keeps me from returning to C++ is the anxiety of learning a depreciated version of the language. But I've also heard that the majority of working software out there uses C++11 and even C++98.

So, if I only learn C++11, would I still be able to do worthwhile shit? Is a significant amount of software still being developed using that standard?

This, I've had to help a bunch of people at work who didn't get C++ memory management because they'd never worked with C and didn't have the right mental model for how shit is structured. I've also had multiple people needing help with includes because they came from Python or similar and didn't realize the compiler literally just copypastes the contents of the included file. Modern C++ is a completely different language than C, but unlike other high level programming languages, you're still exposed to some lower level features and you need to know what's going on under the hood to be effective.

It's actually not a bad idea to start with C++11 to understand things that came later. Once you're competent with 11, you'll see later versions as (mostly) just convenience additions building on what 11 started.

I like C++. I'm currently playing with expression templates and it teaches a lot about the type system and how compilers work.

modern cpp features burrows lots of concept from c#, python. use those first and then youll be more comfortable to tryout the big, high level concepts in cpp (not talking about lowlevel stuff thats better be learnt in c)

C++11 is fine. C++14 and C++17 notions are easily understood if you know C++11. They're usually just cleaned up versions of the same ideas.

Lol VLAs were so shit they were made optional in the C11 standard.

This is a simple example that everyone likes to quote, but the incompatibilities are deeper, especially if you want to write code free of undefined behavior. In C++ objects have to always be constructed through their constructor or via new which calls the constructor. Furthermore type punning through a union is UB in C++ but the idiomatic way of type-punning in C.

Some examples

struct Vector3f {
float x, y, z;
};

Vector3f* vec = (Vector3f*)malloc(sizeof(Vector3f));

vec->x = 2.f;
vec->y = 1.f;
vec->z = 1.f;

The code sample above is a-ok in C but is undefined behavior in C++. No Vector3f object was actually created above this is UB as per the C++ standard.

Things are being worked on in the C++20 and later standards to allow implicit object creation without UB (google std::bless) which will allow the C++ standard to handle things like file-mapping in a portable and standards compliant way.

This, C# is a better choice.

that's fucking retarded, and it looks like it's localised to a single retarded compiler.
godbolt.org/z/QpjjUl

you are correct of course, this is just the most visible example

C++ is not C with classes don't listen to this retard. Read Programming Principles and Practices from the creator of C++ and than move on to C++ primer or Professional C++.

hmmm?

struct void_ptr{
void *ptr;

template
operator T(){
return (T)ptr;
}
};

void_ptr new_malloc(size_t size){
return {malloc(size)};
}

#define malloc new_malloc

int main(){
char *p = malloc(sizeof *p);

return 0;
}

Undefined behavior.

You're undefined behaviour.

brainlet.

>its all the same

std::vector, std::stack, and std::basic_string are good. Rest can fuck off.

Rt to this nigger

C++03, ยง17.4.3.1.1/2
>A translation unit that includes a header shall not contain any macros that define names declared or defined in that header. Nor shall such a translation unit define macros for names lexically identical to keywords.

This is one of those things that's UB but will literally always work.

>using malloc in modern C++
what the fuck are you retards doing

ok then

struct void_ptr{
void *ptr;

template
operator T(){
return (T)ptr;
}
};

void_ptr malloc(size_t size){
return {(void*)new char[size]};
}

I work in cybersecurity and do code audit pretty regularly. C++ is, maybe by a factor of 5 or 6, the most difficult language to audit. 90% of the time you can toss a C++ program in a fuzzer and it'll crash *immediately* in some obscure way that takes 5 hours to understand
I strongly believe that most C++ experts are incapable of creating well-built, non-trivial programs. There's a reason new languages add features like default immutability & borrow checkers, and lack features like preprocessors & templates. Security, correctness, and stability are more important than performance *even in performance-critical situations*.