Welcome! Log In Create A New Profile

Advanced

General C++ Tutorial

Posted by Alex 
Re: General C++ Tutorial
August 02, 2008 07:20AM
C++ was developed in 1979, I don't think it will be replaced soon ;)

Anyway if you learn C++ it's like learning C and Java. C because the syntax is similar and Java because it's object oriented language,
Re: General C++ Tutorial
August 02, 2008 07:30AM
Short answer... no, eventually it will be phased out. look at C for example. It was created in 1972 and is still in use today (although not so much as it was), Almost ever OS is made on it. C++ is currently the industry standard for programming games and most applications. It is a very popular language because it has procedural and object orientated paradigms, there for it apealls to C programmers and C#/Java. Once you have learned the syntax for C++, learning C# is far easier, you don't need to manage the memory yourself for example (if you don't know how much time that saves you will soon find out). I wouldn't worry about C++ dissapearing from programming anytime in the next 10 or 15 years.
Re: General C++ Tutorial
August 02, 2008 07:34AM
Crayon Wrote:
-------------------------------------------------------
> C because the syntax is similar and Java
> because it's object oriented language,

C isn't object oriented therefore their syntax is not similar, Java must have classes and C doesn't even have them.
Re: General C++ Tutorial
August 02, 2008 08:36AM
WiiPhlex Wrote:
-------------------------------------------------------
> Once you have learned the
> syntax for C++, learning C# is far easier, you
> don't need to manage the memory yourself for
> example (if you don't know how much time that
> saves you will soon find out).

How easy is it for people like me, who switch from C# to C++... Syntax is a bit the same... but pointers a complete new for me...

_________________________________
Simplicity... can do complex things.
Singularity... is simple and complex at once.
Re: General C++ Tutorial
August 02, 2008 08:48AM
Dykam Wrote:
-------------------------------------------------------
> WiiPhlex Wrote:
> --------------------------------------------------
> -----
> > Once you have learned the
> > syntax for C++, learning C# is far easier, you
> > don't need to manage the memory yourself for
> > example (if you don't know how much time that
> > saves you will soon find out).
>
> How easy is it for people like me, who switch from
> C# to C++... Syntax is a bit the same... but
> pointers a complete new for me...

C++ syntax is a little more complicated in parts for example, passing reference to a function is required as thus in C#

void function(ref int object);

and in C++

void function(int &object)

Arrays are declared as such in C#, int []array and in C++ int array[]

These were the things that caught me out, not pointers, little things in the syntax that are clearer in C# than C++. Pointers are difficult to understand at the start, but when you use them more you learn it better and understand why on earth its even used (most people fail to see the use of pointers at the start).

In C#, everything is pointers (abstraction), for example, Class.Member in C# would often be written Class->member in C++ (assuming it was used as a pointer). There are a lot of subtle differences but I wouldn't worry about pointers if I were you, they aren't the easiest thing to get a hold of, but if you learn to use them, then your programming will be a lot better for every language you use, you understand memory management a lot better this way.

A side note, try to avoid using malloc in C++.
Re: General C++ Tutorial
August 02, 2008 09:29AM
I know why there are pointers... they're usefull; step 1 :D
I heard form someone else, C# is almost completely pointers, which is strange, because I can use pointers specific in it, which is unrecommended.

_________________________________
Simplicity... can do complex things.
Singularity... is simple and complex at once.
Re: General C++ Tutorial
August 02, 2008 09:37AM
I believe i just said that? Anyway, it is true everything is pointers you just don't know it. You can manually manage your memory using the keyword unsafe although its recommended that you don't explicitly manage memory. When you say int variable = 20, you just created a pointer to somewhere in memory that stores the value of 20, where as in C++ it would create a variable with 20 that contains a pointer to its location which would require another pointer to point to. Theres not really much point in thinking about pointers in C#, theres a reason they say to stay away from them.
Re: General C++ Tutorial
August 03, 2008 07:21AM
WiiPhlex Wrote:
-------------------------------------------------------
I wouldn't worry
> about C++ dissapearing from programming anytime in
> the next 10 or 15 years.

Oh ok sweet. :D So if I learn this, by the time I go to college I will have a step up!!!

Status: Learning C++
Re: General C++ Tutorial
August 03, 2008 07:47AM
For shore, after you have a good handel on C++, you should branch out and try some different languages, C#, Java and a scripting language usually helps, lua or python are popular.
Re: General C++ Tutorial
August 03, 2008 05:12PM
WiiPhlex Wrote:
-------------------------------------------------------
> I believe i just said that? Anyway, it is true
> everything is pointers you just don't know it. You
> can manually manage your memory using the keyword
> unsafe although its recommended that you don't
> explicitly manage memory. When you say int
> variable = 20, you just created a pointer to
> somewhere in memory that stores the value of 20,
> where as in C++ it would create a variable with 20
> that contains a pointer to its location which
> would require another pointer to point to. Theres
> not really much point in thinking about pointers
> in C#, theres a reason they say to stay away from
> them.


erm.. no. If you create a int b = 20; in C/C++ it will normally just put that variable on the stack - no pointer is involved here.
int *b = malloc(sizeof(int)); would allocate memory for an integer on the heap and store a pointer to the memory location in *b - i.e. probably on the stack or just in some register.
Re: General C++ Tutorial
August 03, 2008 08:42PM
Ignore this, posted without seeing there was a page 2 saying the same thing :D



Edited 1 time(s). Last edit at 08/03/2008 08:43PM by mattgentle.
Re: General C++ Tutorial
August 03, 2008 11:15PM
You know what we need? We need a good libwiisprite tutorial... I for one don't really know how to use it, 'cause there is no real documentation...
Is someone willing to wrote one???
Re: General C++ Tutorial
August 03, 2008 11:24PM
Alex Wrote:
-------------------------------------------------------
> I think we need just a basic tutorial, designed to
> get people started with C++, then we can get them
> started on Wii Programming. For general C++
> coding, I recommend this:
>
> Getting Started with C++

Alright it says I need a "compiler" to make the program...What free compiler do you guys recommend?
Re: General C++ Tutorial
August 03, 2008 11:26PM
gcc... it comes with devkitPro, that's all you need. DevkitPro is the all-in-one package for console developing...
Re: General C++ Tutorial
August 04, 2008 12:42AM
Of cource there isn't a folder stuffed with htmls in the documentation folder. :P
Re: General C++ Tutorial
August 04, 2008 01:45AM
Is that good or bad?
Re: General C++ Tutorial
August 04, 2008 02:56AM
LOLDSFAN Wrote:
-------------------------------------------------------
> Is that good or bad?


I was replying to Alex saying that he wanted a libwiisprite tutorial.

libwiisprite includes a API documentation and three examples.
Re: General C++ Tutorial
August 04, 2008 03:19AM
No, I mean like an in-depth tutorial that shows how to do the most common things, that anybody can understand...
Re: General C++ Tutorial
August 04, 2008 03:27AM
The sprite test had a great documentation.
Re: General C++ Tutorial
August 04, 2008 03:36AM
Meh, I just think it would help, would anybody be willing to write one?
Sorry, only registered users may post in this forum.

Click here to login