c++ - what does the presence of an enum keyword as a return type indicate -


i working huge codebase , came across statement

static enum option_file_num fileoption(const char *target); 

now not sure enum option_file return type indicate here ? searched entire code base option_file_num type , not find yet code compiles fine in visual studio. when use same code in mingw gcc following error.

 error: use of enum 'option_file_num' without previous declaration 

my question above statement indicate ?

visual studio non standard extension allows forward declaration of enum's (with no size information).

so seeing feature used here. forward declares enum of name option_file_num , says function returns it.

as extension non-standard, other compilers complain.

either inject proper decl before using it, or if c++11 inject enum option_file_num:int; if remember correctly msvc implicitly. (amusingly, msvc did not support sized enums forward decl, unsized, opposite of standard mandates).


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -