Archived

This topic is now archived and is closed to further replies.

Elite19

What is VB?

Recommended Posts

Elite19    122
Hi, I''m trying to learn c++ but i''m having trouble grasping what pointers are and how to use them. It seems like i''m not taking it in so i went searching around for an easier language to learn to start with. I came across visual basic, is it any good? I heard its easy to learn but i''m guessing that it would be really limited. Is it oop? Could it program something like a 3d app? Any info on it would be great, especially from ppl who use it

Share this post


Link to post
Share on other sites
Nik02    4348
If pointers are the only thing troubling you with c++, don''t switch over to vb for that.
Vb is a neat language, but you can only do so much with it.
C++, on the other hand, gives you flexibility to write anything.

Remember, it''s only my recommendation...

Share this post


Link to post
Share on other sites
Pipo DeClown    804
Pointers and References are HANDY. Once you master them, you''ll be able to make fun of VB. So stick with C++, and keep up the good hope.
Remember, you can always skip learning pointers, till you think you''re ready for them.

.lick

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Remember: everything in a computer is numbers.

Memory is a numbered sequence of bytes. Because of virtual memory, this sequence doesn''t start at 0, but that''s sort-of beside the point. Let''s assume that for every possible 32-bit integer I, there is a byte that has number I.

When you declare an integer (or any variable), it will typically live in memory:

int i = 3; // lives somewhere in memory

Because sizeof(int) is 4, this means that "i" will live at 4 consecutive bytes in memory. Internally, the compiler will keep track of where in memory, by address, "i" lives, and use that address when it wants to know what the value of "i" is.

You can get this value out of the compiler, by using address-of:

int * ptrTo_i = &i;

Note that local variables live in the part of memory known as the stack, which moves around depending on how many functions call other functions in your program. Global and static variables are assigned an address at program start, and then stay there. Dynamic memory (new/delete, malloc/free) is assigned on allocation, and removed on deallocation.


Sometimes, I think people should really start by learning assembly programming. That way, you actually know how the CPU and memory works. Then you can start building higher-level constructs on top of that -- it''s a much better way of going about things than trying to start at the top, saying the lower levels work "by magic," because if you think something''s magic, you don''t know what to expect from it.

Share this post


Link to post
Share on other sites
quake3arena    122
Elite19 i strongly recommend that you do not consider learning any other language other than C/C++, for game programming. Yes learning pointers does take its time , but knowing about the internal workings of the computer specifically about the CPU helps a lot in understanding the C/C++ language.Actually its really simple. Look a variable has to held somewhere in computers memory, which is nothing but a list of numbers so if i
declare this:-int a; what i am telling the c/c++ compiler is that allocate 4 bytes of memory(on a 32 bit system) and whenever i say "a" refer to the starting number of those four bytes. i.e, if a starts at 1000 ( number is used here for simplicity, in actuality, much larger number and that also in hexadecimal are used), then the variable a occupies memory space from 1000 to 1003 i.e total four memory locations. so if i write foll code:- int *ptr=&a; then what i am telling the compiler is that simply store the starting address of the memory that is referred using "a" into the pointer variable "ptr", in this case the "address of Operator" i.e "&" returns 1000 which is then assigned to "ptr". so "ptr" is now storing the starting number (or the starting address of )variable "a" into variable "ptr", infact if you know typecast(s) then you might know it is possible to write the foll code:
void main(){unsigned int iptr=0,a=10;
iptr=(unsigned int)&a;cout<<"& of a is "</*refercing a via typecast(ed) iptr*/
cout<<"value of a is "<<(* (int*)iptr))<Ofcourse if you donot still want to pursue c/c++ i strongly recommend using Java as it is the best oop language i know of (after C++ ofcourse). On the net you may find many languages but please stick to it even if it (yuck)VB. Actually VB is really useful for RAD(Rapid Application Development) for win32 i.e windows programming, but if you want to pursue graphics/game programming its best to stick with the best i.e c/c++. Take your time, look at the net for some of best tuts for c/c++.
Bye for now.
Abbas(quake3arena

No quake3arena has got nothing to with the game or the company but everything with numerology,etc...

Share this post


Link to post
Share on other sites
quake3arena    122
quote:
Original post by Anonymous Poster
Remember: everything in a computer is numbers.

Memory is a numbered sequence of bytes. Because of virtual memory, this sequence doesn''t start at 0, but that''s sort-of beside the point. Let''s assume that for every possible 32-bit integer I, there is a byte that has number I.

When you declare an integer (or any variable), it will typically live in memory:

int i = 3; // lives somewhere in memory

Because sizeof(int) is 4, this means that "i" will live at 4 consecutive bytes in memory. Internally, the compiler will keep track of where in memory, by address, "i" lives, and use that address when it wants to know what the value of "i" is.

You can get this value out of the compiler, by using address-of:

int * ptrTo_i = &i;

Note that local variables live in the part of memory known as the stack, which moves around depending on how many functions call other functions in your program. Global and static variables are assigned an address at program start, and then stay there. Dynamic memory (new/delete, malloc/free) is assigned on allocation, and removed on deallocation.


Sometimes, I think people should really start by learning assembly programming. That way, you actually know how the CPU and memory works. Then you can start building higher-level constructs on top of that -- it''s a much better way of going about things than trying to start at the top, saying the lower levels work "by magic," because if you think something''s magic, you don''t know what to expect from it.



////
To Anonymous by quake3arena
Could`nt have explained it better,(if you don`t believe see my futile attempt below yours magnificient explanation ,-) LOL )
But Seriously, your explanation merely complements mine in the fact that learning c/c++ is really simplified if one starts from assembly, however i would like to point out that i myself started learning about programming from BASIC(Beginner All Purpose Symbolic Instruction Code, (hey i still remember it)), then learned Java,then C++, then to C and after that i quit,(I did`nt want to risk driving myself nuts by learning anything more than basic assembly syntax with relation the X86 architecture and that also for learning advanced debugging.

No quake3arena has got nothing to with the game or the company but everything with numerology,etc...

Share this post


Link to post
Share on other sites
Elite19    122
Thanks for the advice everyone
Well i''ll definately stick with c++ after that, i think i was rushing it and trying to learn to much at once, i''ll just take a step back and get a grip on the basics. Also i''ll check out assembly language to see if that gives me insight into how the cpu works. Well thanks again

Share this post


Link to post
Share on other sites