How to hide global functions from C files in C++ program?

Started by
9 comments, last by Paradigm Shifter 10 years, 8 months ago

I hope g() and h() are just example names of functions and not the ACTUAL names...

Source reorganisation really is the only way to go about this. If you write C programs you really need to use some strategy to avoid global namespace pollution (MODULENAME_funcname is the most usual way of doing that). And as others said use static functions for helper functions which aren't used outside the file (and provide a clean non-static 'public' interface for a module to clients in the header file).

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

This topic is closed to new replies.

Advertisement