• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

Programmers Cafe

Eight Sage

Smash Lord
Joined
Nov 2, 2006
Messages
1,144
Location
in the range of 0.0.0.0 to 255.255.255.255
Most of the syntax is the same as in VB, with the addition of some new keywords and concepts to better support some of the standard features of the .NET platform.
Uff! my problem were if VB.Net had new ways of defining things, I thought it was different. However, I googled .NET code and it seemed the same, but I still had doubts. Now I know it's very similar, no major changes are made it seems.

I'll need to learn the new libraries and components though, but having the same syntax would be quite helpful. Thanks nealdt.
 

SmashChamp

Smash Cadet
Joined
Sep 17, 2004
Messages
74
Location
Flori-tickitickiticki-tock-da!!
Yup, you answered yourself.

That's why Vista isn't good (yet) for programming stuff. Every time a new Operative System is out, you must wait 1 year for it to be establish.
edit: Sorry, not Visual C++ but Visual Studio 2005 so my bad guys. Speaking of which I will simply refuse to muck about doing nothing but wait for 08 to roll around. Thanks again Sage for comment. Please continue everybody with your current topic.
 

Del Money

Smash Champion
Joined
Dec 28, 2006
Messages
2,464
Code:
glColor3f(0.5,0.7,0.9);
glVertex3f(0,0,0);
glVertex3f(-1,3,1);
glVertex3f(1,3,1);
glNormal3f(<insert normal vector function here>);
lol, i hate openGL
 

Mestro

Smash Journeyman
Joined
Nov 5, 2006
Messages
304
Location
Castlevania
Anyone knows how to make a .EXE file from my Visual Basic Project?

I have the 6.0 version (I don't have .NET becuase it's expensive and I only want to make jokes with VB :laugh: )
 

snoblo

Smash Journeyman
Joined
Jul 25, 2007
Messages
361
Hey, I have a question about C/C++...

What's the point of a pointer (no pun intended)?
For example if you have a class called MyClass, what would be the difference than having MyClass obj and MyClass *obj?
I haven't done C++ in a while, but i took a course over the summer a couple of years ago and we never did anything with pointers, so I've been wondering what pointers are used for. I know that pointers are just references to memory locations, but what are the advantages of doing this?
Thanks for everyone's help! =)
 

nealdt

BRoomer
BRoomer
Joined
Jun 12, 2005
Messages
3,189
Location
Long Beach CA
A pointer refers to the memory address of an object. It is not the object itself. So manipulating a pointer literally involves changing the memory address it refers to. In order to work with the actual value pointed to, you have to use certain syntax.

The advantage of pointers has to do with object lifetime and dynamic memory allocation. Objects declared as "MyClass obj;" are created on the memory stack, which is very fast and efficient; however, once that object goes out of scope (the block it was declared in closes), it is deconstructed, popped off the stack, and is no longer valid. Pointers, however, generally are used to keep track of objects created on the memory heap, which is a big block of memory reserved for dynamic allocation. Creating an object with "new" ("new MyClass;") puts that object on the heap and returns a pointer to the memory block. The object stays on the heap forever until your program exits or until you use the "delete" command on a pointer that points to the object's memory location. The heap is slower to allocate and deallocate since the OS has to search through that giant memory area to find a spot big enough for your object (whereas the stack just pushes your object on top and moves on). So why would we ever use the heap?

Here's one example. Let's say you're writing a function that asks the user for his name and returns that as a std::string:

Code:
std::string getUserName() {
   std::string name;
   cout << "What is your name? ";
   cin >> name;
   return name;
}
There's a few things bad about this. First, you're returning the string by VALUE, which means that the entire string that you just scanned is going to be duplicated into a new string object and returned to the calling function. What if your user types in a 1000-char name? Now you've blown another 1K of memory by copying that string just to return it. A better method would be to return a pointer to the string, which would allow the calling function to follow the pointer to access the original variable. You wouldn't be constructing another string object, just a 4-byte pointer to the existing one:

Code:
std::string *getUserName() {
   std::string name;
   cout << "What is your name? ";
   cin >> name;
   return &name;
}
Now the caller can say... "std::string *username = getUserName(); count << *username;" to work with the original string instead of a duplicate. HOWEVER, we still have a problem. Because the "name" variable in getUserName() was declared locally, it went on the STACK, and once the function terminated, that variable was POPPED off the stack. So the pointer return by getUserName() points to a section of memory that is no longer valid. Sure, the data for the string is still there, since it's likely no one else has messed with the stack yet. But you'll run into problems if you continue using that pointer later in the program, and they might be very subtle (like a few missing characters with no explanation). Or your program could blow up with a segfault if you're lucky.

So the proper way to do that function would be:
Code:
std::string *getUserName() {
   std::string *name = new std::string;
   cout << "What is your name? ";
   cin >> *name;
   return name;
}
So that's the most general reason why we use pointers and the heap: to pass around references to objects that stay in existence even when they fall out of scope.

NOTE TO C++ GURUS: yes, I know that std::string uses a char pointer internally and that duplicating a std::string wouldn't duplicate the char buffer... I was just making an example :).
 

snoblo

Smash Journeyman
Joined
Jul 25, 2007
Messages
361
oh, thanks so much!
Another question, is this the same with Java? I've heard that Java objects are just references to the object, not the object itself?
 

Surgo

Smash Apprentice
Joined
Jan 20, 2008
Messages
125
Location
Sitting on the edge of time
It's "sort of" similar with Java. You don't differentiate between allocation on the stack and the heap, and there are no pointers (object-type variables are always passed by reference, primitive-type variables are not). You do not need to explicitly free things; there's a garbage collector that does it for you.

edit:
The heap is slower to allocate and deallocate since the OS has to search through that giant memory area to find a spot big enough for your object (whereas the stack just pushes your object on top and moves on).
This is true, but kind of misleading. Even 'pushing a new object on the top of the stack' could be that point where you need to grab a new memory page, and that's going to take time too. In addition, it's hard to even define what 'searching through that giant memory area' means with today's virtual memory systems (and is certainly OS-dependent); it's not as if it's actually searching for a block of physical RAM that can hold what you're looking to put there. I would be shocked if allocation speed for the heap was ever a bottleneck; it really shouldn't stop you from using it.
 

DaBearX

Smash Journeyman
Joined
May 13, 2005
Messages
325
Location
Chicagoland, IL
Hey everyone,

Checking in after a long time. To the extent that this thread is still active (which doesn't seem so far) I'd like to update my proficiencies to include C#. If anyones interested, I discuss briefly what I've been working on here. Anyone else here dabbled in XNA? Any plans for Community Games?

Bear
 

nealdt

BRoomer
BRoomer
Joined
Jun 12, 2005
Messages
3,189
Location
Long Beach CA
I pretty much **** with C#. Haven't had time to look into XNA, but when it comes to the language, ASP.NET, or the .NET runtime, I can definitely show people a thing or two. :) [/minorhubris]
 

DaBearX

Smash Journeyman
Joined
May 13, 2005
Messages
325
Location
Chicagoland, IL
Haha, cool. I'm no master, but I'm learning quickly. As I recall you develop software professionally right? I don't know if you were ever interested in developing games but XNA could be a great opportunity for you to explore game dev on an indie level. I hope to work on a "semi-casual" 3D action RPG engine starting in January (or some time after I finish PercussONE--my current project) and of course there are dozens of other teams you can find working on projects if you aren't interested on starting one of your own.
 

nealdt

BRoomer
BRoomer
Joined
Jun 12, 2005
Messages
3,189
Location
Long Beach CA
I dunno what you define as "professional"... I do have a degree, but I'm not pursuing a career in software, so all my projects are "personal" in that I design and develop them on my own time and pace. But yeah, XNA does look very cool, and I think it's a great initiative by Microsoft.
 

Steck

Smash Journeyman
Joined
Mar 23, 2008
Messages
238
Location
East Coast
I'm thinking of learning C++. What types of programs are typically made with it (or a better way of putting it is what is it used for in the real world?)

(On the side, stupid computer question: When I delete my trash files, the memory is empty and can be used for something else right? For some reason it seems too easy.)
 

err

Smash Journeyman
Joined
Feb 23, 2006
Messages
293
Location
athens, ga
im too lazy at the moment to scour through the thread (don't worry;; i will soon enough!)

but is anyone programming in OCaml or Common Lisp?


i've gotta say, Common Lisp is my preferred language.. and i just downloaded an intro to OCaml book
 

snoblo

Smash Journeyman
Joined
Jul 25, 2007
Messages
361
I'm thinking of learning C++. What types of programs are typically made with it (or a better way of putting it is what is it used for in the real world?)

(On the side, stupid computer question: When I delete my trash files, the memory is empty and can be used for something else right? For some reason it seems too easy.)
most programs out there are made from C/C++. for almost everything.

and I'm not too sure, but I think when you "delete" a file from your computer, just the reference to the file is deleted, and the actual file may or may not still be on your hard drive. it only can be totally deleted if something else overwrites it on the hard drive (this is what those file-shredder programs do)
 

cheap_josh

Smash Ace
Joined
Mar 24, 2008
Messages
914
Location
Northern Virginia
Just curious... are there any commerical, go-out-and-buy-for-fifty-bucks games made with Java?
Because that's what I'm learning in my Computer Science class. Java.
 

nealdt

BRoomer
BRoomer
Joined
Jun 12, 2005
Messages
3,189
Location
Long Beach CA
No, cheap_josh. No commercial published games are written in Java. But learning Java is going to make it easier for you to learn C++, the language that games are created with.
 

BloodyPuppy

Smash Journeyman
Joined
Mar 19, 2008
Messages
411
Location
University of Maryland, College Park
No, cheap_josh. No commercial published games are written in Java. But learning Java is going to make it easier for you to learn C++, the language that games are created with.
Well I've already fallen from the path of the programmer as a result of Java. I learned C++ my first year of high school, then Java and it totally screwed me up. It just felt like a less flexible C++ and I wasn't enjoying it so I quit programming altogether and took up chemistry. I just don't see the point of learning it.
 

nealdt

BRoomer
BRoomer
Joined
Jun 12, 2005
Messages
3,189
Location
Long Beach CA
Learning any programming language will make learning the second easier. Obviously he'll have to learn proper memory management and how to survive without javadocs, but he's not screwing himself over by taking a Java class.
 

Mr.Bazerkus

Smash Journeyman
Joined
Oct 16, 2008
Messages
383
Location
Interwebs
What is a good Learning path to learning how to program I want to learn C++ ecentually but I want one or two simple easy to use languages that will help in learning the basics of programing.

I've heard once you learn one language it makes the others easier to learn. And if you have any guides please link to them too.
 

streetracr77

Smash Journeyman
Joined
Jul 25, 2008
Messages
488
I'm pretty good with html and know a bit about css and an ounce of javascript. I know there's a lot of helpers, but might as well be one more.
 

streetracr77

Smash Journeyman
Joined
Jul 25, 2008
Messages
488
I have an HTML question. How far does HTML get you when making a webpage. I just recently learned HTML and I'm getting better with it. I see on several online webpages that they're using languages like CSS and php. It makes me think that you need to know more than just HTML to have a decent webpage.
 

SmashChamp

Smash Cadet
Joined
Sep 17, 2004
Messages
74
Location
Flori-tickitickiticki-tock-da!!
Learning any programming language will make learning the second easier. Obviously he'll have to learn proper memory management and how to survive without javadocs, but he's not screwing himself over by taking a Java class.
Not anymore a prerequisite!
anonymous said:
I used to recommend Java as a good language to learn early, but this critic has changed my mind (search for “The Pitfalls of Java as a First Programming Language” within it). A *blank* cannot, as they devastatingly put it “approach problem-solving like a plumber in a hardware store”; you have to know what the components actually do. Now I think it is probably best to learn C and Lisp first, then Java.

Oh how all of this claim comes crashing down like a house of cards. *patpat* cheer up!
 

Velox

Smash Ace
Joined
Feb 14, 2007
Messages
866
Location
Texas (UoH)
I think C++ is pretty much unanimously agreed on as the best starter language. Although, I started with something really basic (Pascal) and then moved to C++ and then to Java. Starting with and OO language first seems like it'd be hard to me, and C++ gives you the freedom to program pretty much any way you'd like. Though people like me inevitably find OO more appealing in the end (you have to..)

and as I think I said earlier in this thread, I wouldn't be too worried about the language you use for first year or two or programming.. It's like melee characters, you'll learn to play them all, although it's true that you'll have that "main" that more often than not you like to turn to. But to restrict yourself to a particular language for the rest of you life is flat out silly.

Java is a highly academic "programming" language though, and that's where I think a lot of its popularity comes from. Back in UIL Comp. Sci. 90% of the students used Java (though C++ and Pascal were other accepted languages). So it just depends on how you're raised I guess.

BTW, I couldn't see LISP as a starting language as a promising endeavor, but I've heard about people doing that I guess. It's kind of.. different though..

people are often mislead about Java and degrade it for lack of memory access and base fundamental operations, but.. maybe they're using Java for something different than what you're trying to use if for.. I still find it the most eloquent language though.. like just as an aside.. For example, it's case sensitivity allows for easier recognizable variable names, as opposed to say C++.

It's just a programmers programming language (Java that is). I'm not here to defend it though.. I'm just saying..
 

Superstar

Smash Champion
Joined
Feb 9, 2007
Messages
2,351
Location
Miami, Florida
I clicked the link to the critic. Kinda say I have to agree. I remember being taught Java in high school, and using it for 4 years. Whenever I tried to dabble in C++, I couldn't get it. Hell, it was only after I gave up and looked up pointers again after understanding a bit about how computers work that I went "OH, now I get it". Not to mention, personally, Java is a very boring language. :p

Trying to head to C++, but since my Uni I think will only teach C++ once I hit graduade level [if ever], I'm trying out C#. Purchased a book on C# Forms and borrowed a book C# fundamentals, and I have to say, that language is sexy. It's a like a Java with a little taste of C++ [delegates, maybe enumerations, structs]. And for kicks, I'm trying to make a game with it [dunno if I'll go into that industry, like I said, just for kicks]. Not XNA though, since it's so new I don't want to give around a runtime, but everyone pretty much has .NET 2.0. Gonna try DirectX drawing. XD
 

AltF4

BRoomer
BRoomer
Joined
Dec 13, 2005
Messages
5,042
Location
2.412 – 2.462 GHz
C# and Java are just about the same. You can practically copy and paste code from one to the other.

But both are a good starting point for a new programmer. They're fairly n00b-friendly, with lots of libraries, a high level abstraction, automatic garbage collection, good IDE's, etc...

Depending on what task you do, and what kind of organization you work for, you could wind up writing in anything from C# to straight up assembly. So it's best to not pigeon-hole yourself into just one language. Make yourself as diverse as possible.
 

Superstar

Smash Champion
Joined
Feb 9, 2007
Messages
2,351
Location
Miami, Florida
Well, that's kinda why I like C#. Although it more or less is the same as Java, it has the feature I found most awesome in C++, passing function pointers as variables. Although it's not the same here as in C++, it's still awesome. I dunno, I just like it.

I have to agree with the pidgeonhole thing. It also gets boring only doing one language. :p And I remember having to write Assembly for GBA homebrew wee back when, in order to draw the map as fast as possible. What fun. XD All those errors and having to learn from an internet list of functions what the ARM processor does and all the memory pointers. I got it working, but I found out the real problem was the sprite routines, I got bored...then my harddrive corrupted and the only way I knew how to fix it was a complete wipe. Yayz. It was fun though, and it was C++, although I didn't know much about it.

As for questions, I have two:
The ole Programmers Notepad -> FileZilla -> Webpage combo is getting boring for me. Anyone know a good PHP IDE that combines the first two, for Windows OR Ubuntu [I have Ubuntu dual booted, although through Wubi, but I don't use it since I need a use for it]. I hear Kate is good, anything about it? EDIT: Someone recommended net2ftp.com, anything about it?

A good book to learn some C++. Maybe I should start learning it after I've done some stuffs with C#, just to sink in the details with that language before moving on?
 

Velox

Smash Ace
Joined
Feb 14, 2007
Messages
866
Location
Texas (UoH)
Plus, as I feel the need to toss this extra bone to Java, I often write programs now-n-days to like, prove a mathematical concept in school (like I used my computer to visibly see why the infinite sum of 1/n^1 is actually divergent, etc.) With Java, I can be sure that I can run my programs at school on my jump drive with it's cross platform, etc. It's useful to be able to do that (like, I wrote a program for Euler's Method in DE, etc.), and it's probably the most important thing I got from high school. I use programming like a tool in a shed.
 

Amigo

Smash Cadet
Joined
May 27, 2008
Messages
38
Location
Australia
Hey, I don't know where else to put this and didn't want to create a seperate thread for it on it's own, so here it goes.

Laterly I've being getting into torrent downloading, but my Internet keeps on disconnecting then reconnecting (I am only downloading 1 torrent at a time by the way). It is only when I am downloading. Also when I play CS:S (this is without downloading torrents at the same time) it will also disconnect and reconnect and I'll be kicked out of the server which is really annoying! Hellppp!

Ohh by the way, just so you know my router is wireless and is model Motorola SBG900 Wireless SURFboard Gateway if that helps at all.

Thank you in advance to whoever helps.

EDIT - Ohh yeh my little sister also complains about the same thing happening in MapleStory when she is playing, so it's not only me. xD
 

SmashChamp

Smash Cadet
Joined
Sep 17, 2004
Messages
74
Location
Flori-tickitickiticki-tock-da!!
1) Amigo. I have nothing but love and will help since you are indeed in dire need; However. Do remember to lurk more to keep the rest of the, "Die Hard programmers" off of you. Will simply state to post your comment in Operating System thread. There, all the help you will get!

C# and Java are just about the same. You can practically copy and paste code from one to the other.

But both are a good starting point for a new programmer. They're fairly n00b-friendly, with lots of libraries, a high level abstraction, automatic garbage collection, good IDE's, etc...

Depending on what task you do, and what kind of organization you work for, you could wind up writing in anything from C# to straight up assembly. So it's best to not pigeon-hole yourself into just one language. Make yourself as diverse as possible.
I hate to have to disagree with you since you are playing both peacemaker and are clearly competent out of the majority; Don't take this as an insult, mate! C++ is NOT user-friendly, yes it has it's moments but please don't put the two as weighing on the same scale as each other. The rest I don't really disagree with.
 
Top Bottom