top button
Flag Notify
Site Registration

What should be the basis of choosing C or C++ for a project?

+4 votes
What should be the basis of choosing C or C++ for a project?
posted Nov 14, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Basis for choosing C:
1.You must meet industry guidelines, which are easier to prove and test for in C.
2.You have tools to work with C, but not C++ (think not just about the compiler, but all the support tools, coverage, analysis, etc)
3.Your target developers are C gurus
4.You're writing drivers, kernels, or other low level code
5.You know the C++ compiler isn't good at optimizing the kind of code you need to write
6.Your app not only doesn't lend itself to be object oriented, but would be harder to write in that form.
Here is strong points for selecting C is that
You want the performance of assembler without the trouble of coding in assembler (C++ is, in theory, capable of 'perfect' performance, but the compilers aren't as good at seeing optimizations a good C programmer will see).The software you're writing is trivial, or nearly so - whip out the tiny C compiler, write a few lines of code, compile and you're all set - no need to open a huge editor with helpers, no need to write practically empty and useless classes, deal with namespaces, etc. You can do nearly the same thing with a C++ compiler and simply use the C subset, but the C++ compiler is slower, even for tiny programs.You need extreme performance or small code size, and know the C++ compiler will actually make it harder to accomplish due to the size and performance of the libraries
and for choosing C++ your projects should be like:
1.Device driver development
3.Advanced engines (audio, image processing, etc)
5.Embedded software (devices and such) where you should choose C++.

answer Mar 22, 2016 by Shivam Kumar Pandey