Question:
Should I learn C or C++ ?
anonymous
2011-09-24 03:22:02 UTC
I have just downloaded MS Visual C++ Express Edition.
I want to write a program to clone hard drives by accessing information sector by sector.
Should I learn C or C++ for this project, which is better suited and could you provide a reason for your answer?
Thanking you in advance
M
Five answers:
?
2011-09-24 03:36:24 UTC
C would work well, but I would use C++. Specifically, I would use C++ to handle all the interfacing and most of the data processing, but hardrive control, would be done with inline assembly.



The only reason is that Im _far_ more comfortable with c++ than I am with C, and since I dont know that C supports inline asm, I choose c++;
peteams
2011-09-24 04:52:33 UTC
This sort of code is normally done using C++ written as if it were C. C++ has some big advantages regarding detecting programming errors earlier than C, which makes code C++ a better language to develop on. C++ can also do unexpected things, a simple looking statement can generate a great deal of machine code, so certain C++ constructs are best avoided. Windows and other popular operating systems are written this way.



Regarding your target, it isn't really a very big project if all you want to do is make a binary copy of a hard disk. Copying a file can take under 10 lines of code to do. Most operating systems, Windows, Unix and Linux based included, present hard disks (and all other devices) as simple files. Great complication arises if you want to copy from one size of disk to another though.
anonymous
2011-09-24 03:35:53 UTC
I depends actually. C is the good choice for code that has to be fast while still being reasonably readable and portable, eg. device drivers. C++ on the other hand is mainly used in large projects of millions of lines of code, where C code would become unmaintainable. This is mainly due to the possibility to reuse existing code by exploiting the OOP concepts of polymorphism and inheritance.

I'd advise you to take your time and learn C++ as it'll be useful once you get the hang of it, it has many advanced features when compared to C.
repp4radu
2011-09-24 03:50:12 UTC
I think you'd better learn C++ because you have much more possibilities by learning Object Oriented Programming. Good Luck!
Anza Power
2011-09-24 05:55:42 UTC
Start with C then move on to C++, it isn't a very big step from C to C++...



C is still important and you might wanna use it sometimes instead of C++...


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...