Languages & Coding > C++ / C#

Understanding c++

(1/5) > >>

Hi guys decided to educate myself in the ways of c++ , I don't want to learn it right now but would like to understand namespace and class's etc.
Anyway I think I get that bit . According to what I read c itself only has 44 words in it's language . When I look at some code in c/c++ it looks pretty damn hard to understand . I would really just like to have an understanding of how it works as might come in handy one day. Are there many AGK people out there using tier 2 ? Is OOP better than a procedural language like basic? I'm really just trying to educate myself . I understand basic and a bit of Python but that's about it and I'm still learning new stuff on a regular basis after using for a couple of years . Have an excellent day.

C++ is a great language... But it's also a beast  :-X

The main thing you really need to get a grip on is resources and allocation.

In languages like blitz and agk. all of the resource and memory management is done for you. You just 'load' something and it's done.

c/c++ is very low level and fast - to do this is has NO memory and resource management. So...
You want to load something - you need to allocate resources, load, track and (THE MOST IMPORTANT THING) release the resources back to the system once you are done with them. If you don't do this correctly then you can make systems do nasty things like crash, have memory problems, all sorts of nasty things that are very hard to track down.

Also be aware that vanilla c/c++ has no string support, so you will have to find (or write) your own systems. and that goes for most everything else. You are going to need frameworks and rely on the work of others and know all about headers. .H and .CPP. thats without all the namespaces, classes, etc.

But in saying all of this - if you can get your head around it - c++ is totally amazing, wicked fast. but horrible to begin with...  ;D

I have to agree with iWasAdam in that it has grown into a powerful beast, and becoming more beastly with every new version.

BMax is like a hugely scaled down version of it so it's not a bad idea to start off by having a go at porting some BMax stuff, assuming you're spot on with BMax of course. At first I would recommend to using the std (standard) library for things such as shared pointer, unique ptr, strings and for your containers such as list, map, set, vector (dynamic sized arrays), and array (fixed sized array). Try not to look at the source for those as for a beginner it will scare the pants off you. If you use c++ and the std library properly (as it's designed to be used - ie no need to use new and delete in your code) then you'll never have memory issues, at the sacrifice of a little loss of speed. Don't worry as you can get that speed back when you know what you're doing.

As with all languages you don't need to use all of its features when starting out so try not to get too far ahead of being comfortable with it.

Class/structs are similar to BMax types except much much more mature, and namespaces just let you put code within a named 'scope'.

Good luck and most importantly... have fun.

Steve Elliott:
I think we've had this conversation before, stop switching/looking at other languages and get the best out of the one you are currently using.  C++ is very much more complicated than AGK Script.  I see you posting many C++ questions here and getting frustrated.  While you don't need to learn the whole language to get by, the code you see online will be written by people who do use all the features, so this will make it much more difficult to learn.

Programming in general is easier once you know one system really well. Learning a second one becomes easier because you can relate to your existing knowledge.

C++ is not a language for beginners, although I know people who have started there. If you do want to head in that direction start with plain old C and learn it fluently first.


[0] Message Index

[#] Next page

Go to full version