Static function in main() meaning

#1

Hi EPI,

I am curious as to the purpose of the static keyword preceding a function defined in main.cpp. I searched google and most explanations of static functions pertain to static member functions of classes, which I understand.

For example your C++: bentleybsearch.cc defines static void SimpleTest() in main.cpp outside of int main().

Another example is C++: student_search.cc defines a const static std::function<bool(const Student&, const Student&)> CompGPA in main.cpp outside of int main().

So my question is what is the purpose of the static keyword in the examples provided. Thank you for your time!

0 Likes

#2

Hi @kolaworld,

Those static function style are not consistent at all, and we are working on a clean up here. Basically, it almost has no difference to have static or not here.

0 Likes