Tutor profile: Karl D.
Subject: C++ Programming
Does a C++ compiler generate smaller code than a C compiler on embedded systems? Which should I use?
Generally, both will produce approximately the same size code. One should take in to account if other firmware engineers in their team understand C++.
Subject: C Programming
What does the keyword "static" mean in C?
The meaning of the keyword "static" has different meanings depending on its usage. When applied to a variable declared outside of a function: The variable can be accessed by any function within that file, but not by any other file. When applied to a variable declared inside of a function: The variable can be accessed by only by that function and the variable's contents will be remain even when the function returns and is called again. If the variable is initialized in the declaration, it will be only initialized the first time the function is called. When applied to a function, that function can only be called by other functions within that file.
Subject: Assembly Language
Is assembly language more efficient than C?
In some cases assembly language will execute more efficiently (result in a smaller hex file) than code generated with a C compiler. However, one also has to be aware of which is more efficient for a company to maintain and for other engineers to read the code. Most of today's C compilers will generate code that is on par with assembly code and sometimes even better.