LogFAQs > #225781

LurkerFAQs ( 06.29.2011-09.11.2012 ), Active DB, DB1, DB2, DB3, DB4, DB5, DB6, DB7, DB8, DB9, DB10, DB11, DB12, Clear
Topic List
Page List: 1
TopicAnyone familiar with C++?
Heroic_CactObo
08/17/11 10:16:00 PM
#20:


C is the predecessor to C++, therefore the syntax is almost exactly the same, but there are some key differences.

C is closer to machine level in that a lot of the stuff that C++ handles in the background, C would have to do manually. Stuff like memory allocation, memory REallocation, string manipulation, and a lot of shorthand stuff like operator overloading. C++ also has object orientation, which makes your life a whole lot easier if you plan on making some more complicated stuff. Other than that, they're pretty similar. C has some advantages like being a good teacher of the basics, and it's also a little bit more efficient so it still has its place in the software development realm.

C# is the bastard child of C++ and .NET and really shouldn't be in the same category. It only behaves correctly in MS Windows (ie you don't need to have a hacky version of a .NET compiler to even run it) because it was developed and built specifically for MS Windows. Don't worry about it first, C++ is a much better language overall.

Java is very similar to C++ in syntax and principles, but it's a little bit more hardcore object orientation, in that even down to primitive data types you're going to be dealing with instantiated objects of classes where in C/C++ it's closer to "this piece of memory." Without getting too technical, I'll try to explain the difference of how Java programs are run vs how C++ programs are run.

C++ you write your code, it runs through a compiler and what you get out is an executable. It can be run directly by the processor because it is a specific set of CPU instructions that must be carried out in a specific order. Very efficient, but also easy to run into problems if you have poor coding skills.

Java you write code that runs through a compiler that spits out .class files, which aren't exactly CPU executables, and they're more of a re-coded version of what you wrote. The only way to run these .class files is to download the Java Runtime Environment. The JRE is basically a virtual machine that starts up when you want to run .class files and takes special care of it while it's running and has to translate it one more time before it gets to the CPU. This has the advantage of being able to take care of things in the background for the programmer like memory management, but has the disadvantage of being less efficient because it has to pass through an extra abstraction layer.

As a side note, the Android OS for smartphones is basically a huge Java library sitting on the Dalvik Java Virtual Machine (not the one Sun Microsystems hands out with copies of Java) on top of a linux kernel. Yes, Android is linux.
... Copied to Clipboard!
Topic List
Page List: 1