I'm developing an embedded application on VxWorks.
I know that the static function is called only in the file where defined and the non static function is called in any file in the source project.
I'm wondering if there is a difference between static and non static function concening execution time and concerning memory
There is absolutely no performance difference. The the only thing the static
keyword does on functions is given them internal linkage, which means they are only accessible in the file they are defined in.
There is no difference in execution times or runtime memory requirements.
Some (many?) linkers will find it easier to spot unused static functions and drop them so they might encourage smaller code size.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With