The forum has been archived
While the forum may not be active, the community still lives on Discord! Click here to join us.

Computer Languages/game Engines?

Phones, computers, tablets, and all other forms of electronic wizardry
User avatar
Newah
Member
Posts: 320
Joined: October 10th, 2012, 12:05 am

Post by Newah »

So if I'm serious about a career in coding, C++ would probably make me better at programming in general?
User avatar
Sebastian Lawe
Moderator
Posts: 2534
Joined: October 17th, 2012, 7:58 am
Design Competitions Voted: 0
Contact:

Post by Sebastian Lawe »

Newah wrote:So if I'm serious about a career in coding, C++ would probably make me better at programming in general?
You'll be a better programmer in the sense that you'll have to handle everything yourself (You'll learn what every program actually has to do. C# sugar coats it). You handle the memory management and garbage collecting, whilst also trying to get the core of your game idea to work. C++ will be much harder, and take longer to get running, but will result in faster code.

C# does the memory management and garbage collecting for you, unless you use unsafe code and tell Visual Studio. C# runs differently than C++ when ran. When you compile a C++ program, its compiled to assembly. While when you compile a C# application, its compiled to intermediate language. What difference does this pose? C# code is compiled to assembly as it needs to be, while C++ is already a compiled executable.

Why does C# code not get compiled to assembly in the first place?

With programming, we like to call a dll for other methods/functions or processes. Well, what happens if a programs keeps calling the same dll over and over? Wouldn't it be more efficient to call it once and make it a part of your program temporarily? That's where C# came about. C# applications are compiled to intermediate language so that dll code can be fused into them and compiled with them. Your multiple dll calls now become obsolete and instead call a method that's inside your application (Which means your are no longer sending requests through windows to access a dll). With that, object oriented programming came to existence, making it easier to understand due to it being tailored to human perception. However, due to C# being compiled on the spot, its very easy to decompile and also runs slightly slower than C++. The speed difference on today's machines is within milliseconds now.

If your a patient person or have tons of time and don't mind handling all the memory management (manually storing values to a memory address and keeping track of what variable is where, building arrays) and garbage collecting (destroying things in memory that your no longer using) then C++ will be a worthwhile language to learn as many game companies use it.

If your somebody like me who doesn't have the time or the patience, C# is much better. If you want to make something, you'll have it done in no time at all. You only have to worry about doing what needs to be done to have what you want working (You don't have to deal with memory management or garbage collecting unless you really have a reason to).

With all of that said, you could put C++ into managed mode making your C++ code compile to IL and use the .net framework (You also don't have to deal with memory management and garbage collecting anymore). However, you may as well go to C# or VB if you want to do that (IL is compiled to assembly on the spot and will run slower due to that).
User avatar
Swords761
Member
Posts: 127
Joined: January 23rd, 2013, 1:27 am
Contact:

Post by Swords761 »

Sebastian Lawe wrote:Above Post...
Thanks for all of that information about the difference between C++ and C#, I didn't know most of that and I'm glad you explained it so simply!
Image
User avatar
Newah
Member
Posts: 320
Joined: October 10th, 2012, 12:05 am

Post by Newah »

Yes, thank you sebane. That's really helpful! I really didn't expect an answer that well constructed. :P
Post Reply