In this article, I am trying to explain some criteria of language selection and describe the difference between the c and assembly language.
When we start a project then language selection is big miles stone. We select the language as per our requirements.
Generally, people select language on the basis of the following points.
- Portability: Portability is the most important factor in language selection. If the source code is not portable then we have to pay a lot of time.
- Maintainability: Language should be easy to understand otherwise it will take a huge amount time for small changes.
- Availability: Compiler and IDE should be easily available in the market and most important thing is that it should be cheap.
- Efficiency: Language has a good efficiency and bug rate should be less.
- Development time: Take less amount of time to develop the project.
If you want to learn more about the c language, here 10 Free days (up to 200 minutes) C video course for you.
C VS ASSEMBLY
Every language has own importance, we cannot say any language good or bad.In my project, we had used only some lines of assembly code beside it all remaining code we had written in C.
There are following points which describe the difference between C and Assembly.
- The c language provides portability and does not depend on the specific platform. It is the biggest advantage of C and this property make people helpless to use C.The code which was written in c could be easily reused on a different platform, beside it Assembly does not provide the portability and source code specific to a processor because assembly instruction depends on the processor architecture.
- Software which has written in assembly perform well as compared to C. Now’s days C compiler generate more optimize assembly code. C compilers generally do better optimizations than you can sustain for hours and days.
- In general, we cannot say compiler-generated assembly code always better, because when human writes a software in assembly then he thinks a lot of scenarios specific to the requirement and processor which did not handle by the compiler.
- In case of micro-controller IDE generate an assembly code (startup code) to initialize the stack, heap, and NVIC. And further, it is hard to maintain Assembly code. So when stack and heap have initialized we used to call a C function to initialize different system clocks.
- I believe API which has written in assembly would be fast. That is the biggest reason to write memset () and memcpy () routine in assembly.
- I believed executable generated by assembly language have smaller size compare to c language but not always true.
Your opinion matters
Here, I have tried to explain the difference between the c and assembly language but I would like to know your opinion on assembly and c language, so please don’t forget to write a comment in the comment box.