Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[C++] Best way learning C++..?

Experienced Elementalist
Joined
Mar 25, 2009
Messages
204
Reaction score
2
Hello! :D

I'm areally bored guy and i wish to learn C++ basics and more step by step.
I wonder what internetguide/bok/video i shoudl watch do learn C++ as fast as possible, but im sure it'll take time,
Please links or tips :D

Live help by msn would also be good lol :p

Well thanks in adv.
 
Junior Spellweaver
Joined
Jun 1, 2009
Messages
129
Reaction score
0
The best way of learning C++ is going to classes and work hard on your spare time.
 
Custom Title Activated
Loyal Member
Joined
Jun 28, 2007
Messages
2,986
Reaction score
3
The best way to learn C++ is to stop learning C++ and to learn Assembly.

How does learning ASM make you learn C++? It's like saying: learn to use a bicycle and you can drive a car!

I learned by internet examples and fora, look for experienced C++ programmers to guide you, it's not an easy language ;), it'll likely take you years to master it.
 
Joined
Jun 8, 2007
Messages
1,985
Reaction score
490
How does learning ASM make you learn C++? It's like saying: learn to use a bicycle and you can drive a car!

I learned by internet examples and fora, look for experienced C++ programmers to guide you, it's not an easy language ;), it'll likely take you years to master it.

It will absolutely take years to master it. Maybe a couple years to even become professional [or to do it for an income]. Don't learn it because your bored and it's just something to do. That's belittling the language a bit.

C++ isn't at all a beginner language, and learning similar, easier languages (like ASM) may help you get the syntax and stuff a little together. In my opinion, you need to really want to learn C++ to successfully learn C++. Be honest with yourself, it's a long windy road.

I certainly hope you do what it takes to get started. It should be allot of work, but worth it. :D:
 
Experienced Elementalist
Joined
May 30, 2009
Messages
298
Reaction score
8
Learn C++ in 21 day's Fifth Edition.
Such a great book, little pricey, but you can find it for free somewhere.
It explains it as if you never even programmed before.
 
WowIwasSuperCringeB4
Loyal Member
Joined
Jun 21, 2008
Messages
1,297
Reaction score
226
 
Ginger by design.
Loyal Member
Joined
Feb 15, 2007
Messages
2,340
Reaction score
653
How does learning ASM make you learn C++? It's like saying: learn to use a bicycle and you can drive a car!

I learned by internet examples and fora, look for experienced C++ programmers to guide you, it's not an easy language ;), it'll likely take you years to master it.

That's a really bad analogy. ASM is not to C++ as using a bicycle is to driving a car. And using C++ is not comparable to driving a car. Learning C++ is comparable to learning how to BUILD cars.


C/C++ are at a much lower level than other languages (granted things like certain OOP features of C++ and the STL make it seem not so much). The way the C language was developed was a direct result of how assembly on x86 systems operated. C++ is an "extension" if you will and so the same lesson applies. Learning about the stack, to distinguish the free store and stack space and how it works, to understand how pretty much all of the libs interact and how they operate and to be able to look up how any function you use works.. and understanding how your systems memory operates and the limitations you have to work around (which can lead to efficient development) is a powerful idea. Not only that, but knowing ASM makes learning C/C++ easy, because things that are "foreign" to most beginners (making pointers difficult, understanding that data can be interpreted many different ways etc) come naturally when you've been in that environment.

90% of newcomers would think if they used C# or Java in the past that:

PHP:
int my_array[1000];

PHP:
int* my_array = new int[1000];

Are the same with the exception that the latter needs to have the memory freed with delete[]. The simple fact is that the first results in the stack frame having your ebp subtracted by another FA0h, and the second has to go out to the heap and grab a FA0h sized block and return the pointer (which is many thousands of times slower than a simple sub ebp,FA0h operation).

Trust me, it makes a HUGE difference to know ASM. Additionally, for what most people around here will want to do, they'll need to reverse or debug something eventually.. that's easy if you know both :).
 
Custom Title Activated
Loyal Member
Joined
Jun 28, 2007
Messages
2,986
Reaction score
3
Of course, I agree very much that knowing ASM is a great asset in your programming career. Especially for people using C. But C++ is quite different, C++ is more about design methods, safety and other high-level concepts you won't find in neither C nor ASM. Knowing ASM will give you a good ground to build on, but it does not in any way teach you C++.

This guy wants to learn C++, not ASM or C.
 
Skilled Illusionist
Joined
Apr 22, 2009
Messages
301
Reaction score
19
If you want to get familliar with syntax, i would recommand starting with php, of coruse you wont make programs like in C++ but php is imo a good start.
 
Ginger by design.
Loyal Member
Joined
Feb 15, 2007
Messages
2,340
Reaction score
653
Of course, I agree very much that knowing ASM is a great asset in your programming career. Especially for people using C. But C++ is quite different, C++ is more about design methods, safety and other high-level concepts you won't find in neither C nor ASM. Knowing ASM will give you a good ground to build on, but it does not in any way teach you C++.

This guy wants to learn C++, not ASM or C.

That's like wanting to learn how to build sky scrapers without first learning how to build small homes and buildings.

And it's still relevant, look at my example. A novice learning C++ *ONLY* would not know this. I see my classmates in college, even graduate level courses writing software to implement algorithms and class assignments.. and it's BAD. They simply abuse their lack of knowledge SO HARD that their applications are miserable. One of the assignments last semester was to write an application to find ONE solution to the n-queens problem for an arbitrary n. Mine did it no problem for n > 1,000,000.. he wanted us to try to get that high with a good heuristic approach, but I think the next best in a class full of people who are seniors in college, and not stupid people, was 3000 before the system was hosed. Why? It was done in C++ but so poorly that it couldn't run within hardware limits (memory mainly). Tsk tsk tsk. My implementation wasted no memory, 1 billion in size and each column is represented by a single 32bit variable so 4 gigs of memory used just to store the state of the board, so without sufficient RAM or a paging technique, the algorithm breaks down (though it only takes a few hundred iterations to find a solution).. and after 10-20 iterations it's down to 1/1000th of the board size so you could easily page out all the unneeded crap early on.

One step at a time. Learning a HLL to program is the worst way to write software. It teaches you to rely too heavily on toolkits and frameworks to do everything for you, to ignore security issues, to not think critically about how to solve a problem or how to structure data you need to most effectively or efficiently process it, and most of all, the common algorithms that such high level libraries and frameworks give you access to are wasted as you don't have an appreciation for ever needing to set them up yourself.

Learning C++ is pointless. Learning to program is what he really wants to do. The language really does not matter, but to learn procedural and OOP (which stems from procedural programming) programming, you need to start somewhere more fundamental. With that ability, the language really is just a syntax or a shell towards doing what you want to do, and you can easily write software in many languages. This is why so many students in college who get taught Java as a first language (or even in HS) are pretty bad off. They are immediately taught to abuse the garbage collector, to abuse the fact that in a VM you can't have buffer overflows (or you'll get an exception, in which case your program will crash, but we all know about those printfs with malformed arguments that DONT cause program crashes, not even readily, but are seriously exploitable and cause massive instability), and when you need something done, load up the java API and find a class that does it for you. Byebye creativity, byebye problem solving. "I cant find a class to do this for me, so I don't know how"....

If you want to get familliar with syntax, i would recommand starting with php, of coruse you wont make programs like in C++ but php is imo a good start.

PHP is very similar to C. If he gets comfortable writing applications in C, PHP will feel second nature to him. (minus some changes such as types.. arrays.. etc.. it's a bit different not being a strictly typed language).
 
Custom Title Activated
Loyal Member
Joined
Jun 28, 2007
Messages
2,986
Reaction score
3
I don't see why we're argumenting, I pretty much think alike. But if he wants to learn the "shell" called C++, he should. You can either go high-level to low-level, or vice versa. I did the former...it doesn't really matter. As long as you do both extremes :)
 
Custom Title Activated
Loyal Member
Joined
Aug 8, 2004
Messages
3,892
Reaction score
20
That's like wanting to learn how to build sky scrapers without first learning how to build small homes and buildings.
Your analogy is apt, yet its application is reversed. Your algorithm was not better because it was written by someone with knowledge of C++ or ASM. It was better because it used the available hardware more efficiently. A good programmer knows that an A* search will be more efficient dan BFS, what he knows about the used language is irrelevant. You can be an expert in C++ and ASM and code more efficiently than god, if you use BFS where a good heuristic is available your program will still be many times slower than my program using A* (or pretty much any good search algorithm).

Which is what you already stated, though in not so many words: what is important is an understanding of the algorithms you use, far more important than micro-optimalisations for a specific language. Whoop-tie-f*ckin'-doo, your program uses a BFS with 10% less memory useage than your classmates implementation. How usefull is that if my program uses 95% less memory because the algorithm I used is better?

An interesting read which pops up as one of the first hits on google for should clarify it better than I am willing to do here.

Long story short: ASM is a waste of time. What matters not is how memory is allocated, when it is freed, or even which particular type of string operation is faster. What really matters is the overal performance of your program which is directly related to the efficiency of your algorithm. The more you can focus on that instead of on silly little details the better, and yes that means the more abstract and higher level your language is the better. JAVA, Python, C# and PHP are excelent choices when it comes to learning how to program, anything lower level is interesting and will give you a better understanding of what you do, but it will not make you a more efficient programmer.
 
Newbie Spellweaver
Joined
Jun 19, 2009
Messages
26
Reaction score
0
I know some ASM but really I started off doing C++ when I was a kid and it didn't take so long to master it.
 
Ginger by design.
Loyal Member
Joined
Feb 15, 2007
Messages
2,340
Reaction score
653
Your analogy is apt, yet its application is reversed. Your algorithm was not better because it was written by someone with knowledge of C++ or ASM. It was better because it used the available hardware more efficiently. A good programmer knows that an A* search will be more efficient dan BFS, what he knows about the used language is irrelevant. You can be an expert in C++ and ASM and code more efficiently than god, if you use BFS where a good heuristic is available your program will still be many times slower than my program using A* (or pretty much any good search algorithm).

Which is what you already stated, though in not so many words: what is important is an understanding of the algorithms you use, far more important than micro-optimalisations for a specific language. Whoop-tie-f*ckin'-doo, your program uses a BFS with 10% less memory useage than your classmates implementation. How usefull is that if my program uses 95% less memory because the algorithm I used is better?

An interesting read which pops up as one of the first hits on google for should clarify it better than I am willing to do here.

Long story short: ASM is a waste of time. What matters not is how memory is allocated, when it is freed, or even which particular type of string operation is faster. What really matters is the overal performance of your program which is directly related to the efficiency of your algorithm. The more you can focus on that instead of on silly little details the better, and yes that means the more abstract and higher level your language is the better. JAVA, Python, C# and PHP are excelent choices when it comes to learning how to program, anything lower level is interesting and will give you a better understanding of what you do, but it will not make you a more efficient programmer.


That's not really accurate. If you're writing system or performance critical software, the algorithms become just a small part of it (unless the performance is purely CPU intensive, in which case the best algorithm does a great deal for you). However, in these types of systems, (perhaps a game rendering engine for example), optimizations can have a HUGE impact on performance (non-algorithm related optimizations, rather resource optimizations). Similarly, consider a highly performance critical server application, such as a server emulator which needs to be capable of running with as many client connections as possible, efficient memory and resource management is absolutely CRITICAL or your server will be poop under any kind of semi-realistic load.

In general, it almost entirely depends on what you want to make. If you know lower level languages and understand what's going on better, and know algorithms and OOP design concepts, and common data structures VERY well, you can make pretty much anything you want (that doesn't require specialized knowledge.. such as writing a 3d graphics engine), but at that point you can probably specialize in something and write a very nice niche application/utility/engine. If you know one high level language, how to use a few algorithms, and how to abuse a MASSIVE framework of classes that do all the work for you, you won't really be able to produce whatever you want, though you might be able to make a certain kind of application quickly. The idea behind learning ASM first is to get the necessary low level understanding for C/C++ and get the technical ideas behind WHY PROCEDURAL PROGRAMMING IS THE WAY IT IS.. then you move onto actually applying C/C++ to do things you want to do and applying algorithms to solve problems quickly.
 
Back
Top