Usually when I want global functions in my C++ applications I do like this:
namespace Tool
{
static inline int foo() {}
static inline int bar() {}
}
int main()
{
Tool::foo();
Tool::bar();
}
Another more common way to achieve this result is by doing it this way:
struct Tool
{
static inline int foo() {}
static inline int bar() {}
};
int main()
{
Tool::foo();
Tool::bar();
}
So to my question: Is there a difference between them (have not checked the generated code yet)? Which one should I prefer and why?
Thanks for your thoughts!
/Klarre