2

I know from C, that the static qualifier on functions limits their visibility to the current translation unit. In C I use static, if I define a function in e.g. a *.c file, which is intended for use wihtin that file only (mostly specialized helper functions). I did not find any information on how this is treated in C++. I only found information on how to apply static to member functions. But in my case, there is no class involved. As far as I tested it, using static on functions in c++ does not produce any compiler warnings and works just fine. Is it acceptable to use it in the same way as in C as stated above? Is it common practice or bad practice?

Richard Neumann
  • 2,986
  • 2
  • 25
  • 50

0 Answers0