I'm learning C++ but I feel uncomfortable with programming

I'm learning C++ but I feel uncomfortable with programming.
I want to be able to break down a simple C++ program with a complete understanding of what is going on at hardware level.
If not from the physical point of view, from the logical.
Would be this excessively time consuming?
Mind you I don't really know myself what I am asking since I'm a complete ignoramus in this field.
Physics graduate and mathematician by training NEET at the moment.

Other urls found in this thread:

Veeky
nand2tetris.org/
harmful.cat-v.org/software/c /
cplusplus.com/reference/ostream/ostream/
youtube.com/watch?v=9PPrrSyubG0
godbolt.org
twitter.com/NSFWRedditVideo

I don't get it, how are you learning C++ if you don't know what the code is doing?

Literally me

>I don't get it, how are you learning C++ if you don't know what the code is doing?
I *know* what the code is doing but I don't know what is going on inside the magic box that is called computer.
By the way I'm using:
>A complete guide to programming in C++
>Book by Ulla Kirch-Prinz

>Would be this excessively time consuming?

I shouldn't take you more than a year to learn C++, digital logic, computer architecture, data structures and algorithms.

Learn how to program microcontrollers in C and study computer architecture

Where do I find a good self contained bibliography?

Just learn about C and Assembly. If you want to know it on a more basic level start from circuits and work up.

Veeky Forums-science.wikia.com/wiki/Computer_Science_and_Engineering

I got you, OP.

"From NAND to Tetris" is what you need.

nand2tetris.org/

Wibbley Wobbley Bits Getting Naughty With The Atoms user.

1. Switch to C. Because of operator overloading, C++ hides a lot of what is happening.
2. Learn how Unix-like systems work and how C elegantly uses their capacities. If you can use argv more often than scanf and fgets, you are doing things right.
3. Reinvent the cstring functions with pointer arithmetic and trying to be as minimalist as possible by abusing operator precedence.
4. Learn about CPU caches and pipeline and how they can be used to optimize code.
5. Learn the difference between static, automatic and dynamic allocations and where they occur in memory.
6. Get familiar with the system calls of the OS you use (they differ between Linux x86, Linux 64, BSD and Plan 9).
7. Learn assembly.

C is a lightweight language, so you may be able to do all that within 2 or 3 months.

Thank you all and thanks in advance for any future posts.

>1. Switch to C. Because of operator overloading, C++ hides a lot of what is happening.
You have no idea what you're talking about.

C++ is harmful.
harmful.cat-v.org/software/c /

Learn simple C.

>Calculus is harmful
>Learn simple arithmetic

>trying to be as minimalist as possible by abusing operator precedence.
That's not what "minimalism" means, you fuckstick. That's just writing shitty code.

>cout

C++ is a relatively high-level language. Once you understand it enough go to an assembly language, then just computer architecture / digital logic, etc.

Adds "hello\n" to the output stream buffer and then flushes.

>Writing short code is minimalism.
No, writing simple code is minimalism.
There's a very important difference.

Yes but what exactly does that entail? Which library functions are called? What parts of the runtime get used? What does the stack look like during all this?

Hey user I like your style, this inquisitiveness is why you succeed if you continue down this path and you can make lots of money if you study this a lot

I suggest learning C first
Then learn a basic assembly language like MIPS32

Then you will understand

C++ is a programming language, there are many others. Programming languages are parsed and their corresponding tokens and symbols are converted into an abstract syntax tree representing what the program is doing, and this is then converted into assembly language, which is then converted into machine code, which is then organized into an executable file for instance a *.exe, then when you run it the OS creates a process, loads the code into memory, sets the program counter register to point to the "entry point" of the program i.e. the first CPU instruction executed, and it goes on from there

The main types of CPU instructions include addition, subtraction, multiplication, division, conditional branching, and memory writes and reads

It will indeed be time consuming to really learn this thoroughly, this stuff in depth is at the level of a Bachelor's degree in Computer Science but you can get a feel yourself by self studying the topics I said

sorry, if you guys can't compile your code by hand you aren't really learning the language

>cout is simp-
cplusplus.com/reference/ostream/ostream/

Petzold's "Code"
read it

C++ is such a nightmare dont do it. I am a programmer. You dont need to do C++. Do Go or Haskell, or whatever suits what you are doing.

The is that way.

I legitimately just do not understand this viewpoint

Why is C++ a nightmare?

It's a beautiful language with a beautiful class system and most importantly a truly awe inspiring template system

I hesitate to say this, but I think most people who think C++ is a nightmare just don't understand it. Why do you say it's a nightmare? What do you mean? Too complicated? Actual issues you have with the language itself

It's a great language

>It's a beautiful language with a beautiful class system and most importantly a truly awe inspiring template system

Because its compilicated, and has a lot of weird and unexpected behavior and its compiler errors say shit like "Abort trap 6" that doesnt make any sense. You just dont have to deal with that crap with languages that perform just as well.

What other languages have you used?

Mainly C and python

As far as I'm concerned
>Every dynamically typed language is unacceptable garbage
>Every interpreted language, even those with JIT, are unacceptably slow
>Every managed language is slow garbage
>Garbage collection is unacceptably slow garbage

C++ gives weird ugly error messages at compile time because otherwise they would be weird ugly anomalous behavior at runtime in other languages. Be happy it gives you those errors

Also it doesn't say shit like "Abort trap 6" it gives shit like "Unable to find specialization of scope1::scope4::scope5::class1::class3::Veeky Forums::cuck::blarg

>C++ gives weird ugly error messages at compile time because otherwise they would be weird ugly anomalous behavior at runtime in other languages. Be happy it gives you those errors

Are you clueless? No, it could have good errors at compile time instead of bad ones. "Abort trap 6" is a bad error message. "Hey, the memory is breaking at this point for this reason" is a good error message. Some languages have those good messages.

Im not surprised you code in mainly C and Python. Those languages are both older than I am (26), and in the mean time theres been advancement in programming languages.

>Abort trap 6
Idk what the fuck compiler you're using. Searching "Abort trap 6" results in a bunch of C questions. C++ compilers generally give good error messages once you're familiar with what they mean

Don't be a faggot learn lisp.

I'm currently learning C with K&R in order to get a good understanding of programming before learning C++.
Some people have recommended I drop K&R and pick up Harvard's online CS50 course instead, would that be a bad idea?
When I'm done with C, what are the best introductory resources to C++? Preferably books.

>I want to be able to break down a simple C++ program with a complete understanding of what is going on at hardware level.
Forget it.
If you wan't to do that you should either learn C (nearly a subset of C++) or go directly to assembly language (this is pretty pointless though if you care about jobs).
C++ is by far too abstract for programs to be analyzed that way.

My advice is that you should start with C, there you can understand what is happening. After you mastered C you can move on to C++.

is completely right.

>Why is C++ a nightmare?
It is a language which includes every feature a programming language could possibly have.
C is such a great and widely used language because it "kept things simple".

And you don't need to listen to me, hear it from the creator of C++ himself.

"Within C++, there is a much smaller and cleaner language struggling to get out."
-Bjarne Stroustrup

C++ is the definition of bloat, something which couldn't stop growing and which is now a language which barely one person in the whole world understands completely.
Sure there are some great features within, but you need to avoid thousands of its other features to make something which resembles readable code.
You can and will create monstrosities of programs if you are not a really good programmer (or someone on your team isn't) and try to actually use its features to their whole extend. (the person who though that operator overloading was a good idea needs to be shot)

Bump

...

If you want to learn C++ you should just go use C++

1. install ubuntu
2. install code::blocks
3. Go apeshit

You might not get anywhere for a long time.

If you have never programmed anything before, it will take a while.

>1. install ubuntu
>2. install code::blocks

or use visual studios like a sane person.

Or use emacs and gentoo like a non-brainlet fucktard.

>(the person who though that operator overloading was a good idea needs to be shot)

Bitch please

My nigga

If you can't into C++ you shouldn't be trusted with a computer

>visual studio
fuck I hate summer

There is no reason to hate Visual Studio as long as you're simultaneously making sure your code compiles in gcc or whatever else you want

Visual Studio's debugging environment is absolutely top notch. Especially for inspecting the contents of complex nested template objects

If your primary task while writing code is "text editing" and you need fancy shit provided to vim/emacs then you're probably doing things wrong to begin with. This one always makes me chuckle

It's malware. They obviously spend so much money on it so they can fuck you with it and shill their products. As a programmer, you need your tools to work. If you were actually serious you wouldn't trust it.

If you use Visual Studio you simply are not with the shits.

Okay? Then develop inside virtualbox with networking disabled faggot

It's not an issue

Fuck off back to /g/. You don't belong here.

Or just don't be a black nigger and use something less shit

It's not shit though it's really great

Name me another good way to debug the contents of nested STL containers or something

Reading the code

>Debug by reading the code

That's a new one user thanks for the advice, we don't even need debuggers with this breakthrough /s

You've clearly never worked on any remotely complex systems involving parts from many different teams with millions of lines of code.

That's very hard. The firmware + hardware itself will take a long time to understand, let alone everything between them and C++.

Did this autistic shit, too, and it's a major impediment to successfully learning a programming language. C++ isn't going to tell you shit about the hardware level, at least not at first...

Think of it this way: it's better to get a grasp of modern French (Spanish, German, etc) and work backwards, than throw yourself into Medieval French and try to work your way up to modern French, because you're worried about missing all the "insights".

>1. Switch to C. Because of operator overloading, C++ hides a lot of what is happening.
HAHAHAHAHAHA

>implying stdio functions are any less opaque
okey dokey

There's no particular order to learn it in, but yes, it will be time consuming.
Spent about 10 minutes just now trying to think about how to best break it down and realized that it really is a fuckton of information, it took me about 2 years to get it all (that was in uni, of course, so you can definitely learn it much faster)

Physics lets us understand electrical circuits and make transistors.
The transistors make CMOS circuits.
The CMOS circuits make logic gates.
The logic gates make circuits that can store their inputs (flip-flops) and perform computations (look up the "adder" circuit) on their inputs.
Those memory/computer circuits make complex datapath/arithmetic/pipeline circuits.
We can run various series of inputs in sequence through those complex circuits to make them do stuff. We call those input series "programs"
Writing the programs as long strings of 5V/0V (1/0) sequences is hard, so our first program is a translator to let us write "assembly" code.
Assembly language can be annoying, so our next program is one to translate our C code into assembly.
Writing C can be annoying, so our next program is one to translate even higher level languages into assembly.

youtube.com/watch?v=9PPrrSyubG0
Meant to include this.

x86 manual + godbolt.org