I have a file with a set of functions. For one of the functions, I want to write a helper function which basically takes a char * and skips all whitespaces.
Here's how I thought it should be done:
namespace {
const int kNotFound = -1;
void SkipWhitespace(const char *s); // forward declaration - doesn't seem to work?
}
void foo(const char *s1, const char *s2) {
// do some stuff
SkipWhitespace(s1);
SkipWhitespace(s2);
// continue with other stuff
}
void SkipWhitespace(const char *s) {
for (; !isspace(s); ++s) {}
}
But this gives me a compiler error. Do I need to put the definition within the unnamed namespace?