Live data from Hacker News

LearnCPP: Website devoted to teaching you how to program in C++

learncpp.com

11–20 of 145 posts

Re: LearnCPP: Website devoted to teaching you how to program in C++

#11

After many headaches trying to get Numba to work with Python, I decided to just go out and learn C++. This was my main resource and can highly recommend.

As a C++-head with little experience in Python - I would ask you to elaborate a little. What were trying to achieve with Numba, that gave you headaches?

Re: LearnCPP: Website devoted to teaching you how to program in C++

#12
As a newbie into programming, I get pulled all the time by people to learn my first compiled language either in C++ or Rust. Every time I ask even the most innocent question in any forum it becomes a shitshow, and I can see, I'm late to the party here in HN.

Re: LearnCPP: Website devoted to teaching you how to program in C++

#13

As a Java dev who learned C++ at university the hate towards C++ is misplaced. C++ is a no thrills language which lets you have freedom but freedom to also shoot yourself in the foot 100+n ways, but this gives you a good foundation as a developer IMHO. Every time I think about garbage collection in Java, I can appreciate that I am not having to write code to destruct an object or worry about passing references incorr…

I haven't used Java since school so I'm curious about modern Java. Do you need to worry about circular references preventing garbage collection or are there easy tools to detect such cases?

Re: LearnCPP: Website devoted to teaching you how to program in C++

#14

[flagged]

Statements like these only serve to polarize people, not encourage them to write safer code / use safer languages.

There are many places where C/C++ (and many other non-Rust languages) are still used, and where it would not be feasible at this time to fully rewrite them in rust.

Modern resources like the OP posted should be encouraged, as they actively teach about proper use of the language, and foot-guns to avoid (e.g. don't use c-style strings + strcpy, use smart pointers, etc).

Re: LearnCPP: Website devoted to teaching you how to program in C++

#15

As a Java dev who learned C++ at university the hate towards C++ is misplaced. C++ is a no thrills language which lets you have freedom but freedom to also shoot yourself in the foot 100+n ways, but this gives you a good foundation as a developer IMHO. Every time I think about garbage collection in Java, I can appreciate that I am not having to write code to destruct an object or worry about passing references incorr…

For Java'eans, here's an interesting StackOverflow question about why there's no Garbage Collector in C++ and what it means:

https://stackoverflow.com/q/147130/1593077

and my particular answer:

https://stackoverflow.com/a/48046118/1593077

in essence, with Modern C++, it is relatively easy to just not produce garbage which needs to be collected :-)

Re: LearnCPP: Website devoted to teaching you how to program in C++

#16

[flagged]

Why do you think C++ is like smoking?

They're likely referring to the (not too crazy idea) to slowly deprecate C++ in favor of Rust. There's plenty of extant code to work on, of course.

https://www.zdnet.com/article/programming-languages-its-time...

Re: LearnCPP: Website devoted to teaching you how to program in C++

#17

As a Java dev who learned C++ at university the hate towards C++ is misplaced. C++ is a no thrills language which lets you have freedom but freedom to also shoot yourself in the foot 100+n ways, but this gives you a good foundation as a developer IMHO. Every time I think about garbage collection in Java, I can appreciate that I am not having to write code to destruct an object or worry about passing references incorr…

I haven't used Java since school so I'm curious about modern Java. Do you need to worry about circular references preventing garbage collection or are there easy tools to detect such cases?

[deleted]

Re: LearnCPP: Website devoted to teaching you how to program in C++

#18

As a Java dev who learned C++ at university the hate towards C++ is misplaced. C++ is a no thrills language which lets you have freedom but freedom to also shoot yourself in the foot 100+n ways, but this gives you a good foundation as a developer IMHO. Every time I think about garbage collection in Java, I can appreciate that I am not having to write code to destruct an object or worry about passing references incorr…

I haven't used Java since school so I'm curious about modern Java. Do you need to worry about circular references preventing garbage collection or are there easy tools to detect such cases?

Java will collect sets of objects with circular references: https://stackoverflow.com/questions/1910194/how-does-java-ga...

Re: LearnCPP: Website devoted to teaching you how to program in C++

#19

As a newbie into programming, I get pulled all the time by people to learn my first compiled language either in C++ or Rust. Every time I ask even the most innocent question in any forum it becomes a shitshow, and I can see, I'm late to the party here in HN.

Learn whatever you really want to. They are just 2 tools, and either of them will teach you something. You can't make any mistake, if your plan is to learn and maybe build something simple. If you want career advice, that's where things might get a little bit religious...

Re: LearnCPP: Website devoted to teaching you how to program in C++

#20
The website sometimes fudges things with somewhat-incorrect statements. Maybe it's a minor issue, but I noticed that it says, for example:

> When an initializer is provided after an equals sign, this is called copy

> initialization. Copy initialization was inherited from the C language.

>

> int width = 5; // copy initialization of value 5 into variable width

>

That's not quite right. Consider the following program:

    #include 

    struct A {
        A (const A& other) : x{other.x} { std::cout 
The constructor used here will not be the copy constructor. There will be just a single construction, of a1, and it will be the "int ctor", i.e. `A(int x_)`.

See it on GodBolt : https://godbolt.org/z/eT8soWMxE

I don't know if this characterizes other parts of LearnCPP, haven't gone through it myself.

Post reply on HN