#define GETSTRING(s) return #s
enum a_type { SMALL, MEDIUM, LARGE };
const char* get_data(a_type a) { return GETSTRING(a); }
int main() {
a_type at = SMALL;
const char* s = get_data(at);
return 0;
}
I get compiler error:
main.cpp(5) : error C2059: syntax error : 'return'
What have I done wrong?
If you use gcc -E
to output the preprocessed source, you'll see you have an extra return
in get_data
:
const char* get_data(a_type a) { return return "a"; }