I much prefer this one:
#include <cstring>
static int is_valid_function_name(const char *function_name_string){
return std::strpbrk(function_name_string, "?/\\:*<>\"") == NULL;
}
By the way, qualifiying a global name as static to give it internal linkage is a deprecated feature. If this was the original intent of the function--as opposed to a static member function declared as inline--then an unnamed namespace is the recommended option:
namespace {
int is_valid_function_name(const char *function_name_string){
return std::strpbrk(function_name_string, "?/\\:*<>\"") == NULL;
}
}
Though, ZuK, it strikes me that the original code may have been C instead of C++. In that case you may have just confused the OP more. If it really was C++ then I wonder why the return value was not bool.
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Offline 11,807 posts
since Sep 2004