title: I'm getting an error concerning enum (I think)
body: <p>I'm testing code remotely on a Solaris machine through SSH Secure Shell using c++. Not sure of what version anything is; Solaris, the c++/compiler, etc. (and don't know how to find out through SSH Secure Shell)...</p>
  
  <p>This code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;cstdlib&gt;
  #include &lt;errno.h&gt;
  
  using std::cout;
  using std::cin;
  using std::string;
  
  
  enum STR_TO_INT_STATUS { SUCCESS, OVERFLOW, UNDERFLOW, INCONVERTIBLE };
  
  STR_TO_INT_STATUS str_to_int( int&amp;, char const*, int );
  
  
  int main()
    {
     int num;
     string str;
     STR_TO_INT_STATUS code;
  
     cout &lt;&lt; "\nEnter a string containing numbers: ";
  
     cin &gt;&gt; str;
  
     code = str_to_int( num, str.c_str(), 0 );
  
     if( code == OVERFLOW || code == UNDERFLOW )
       cout &lt;&lt; "\nThe number was out of int's range\n\n";
     else if( code == INCONVERTIBLE )
            cout &lt;&lt; "\nThe string contained non-number characters\n\n";
          else if( code == SUCCESS )
                 cout &lt;&lt; "\nThe int version of the string is: " &lt;&lt; num &lt;&lt; "\n\n";
    }
  
  
  STR_TO_INT_STATUS str_to_int( int &amp;i, char const* s, int base )
    {
     char *end;
     long l;
     errno = 0;
  
     l = strtol( s, &amp;end, base );
  
         if( ( errno == ERANGE &amp;&amp; l == LONG_MAX ) || l &gt; INT_MAX )
           return OVERFLOW;
  
         if( ( errno == ERANGE &amp;&amp; l == LONG_MIN ) || l &lt; INT_MIN )
           return UNDERFLOW;
  
     if( *s == '\0' || *end != '\0' )
       return INCONVERTIBLE;
  
     i = l;
  
     return SUCCESS;
    }
  </code></pre>
  
  <p>compiles and works fine... as you can see, it converts a string entered by the user into an int...</p>
  
  <p>But when modified like so:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;cstdlib&gt;
  #include &lt;errno.h&gt;
  #include &lt;limits&gt;
  #include &lt;cmath&gt;
  
  using std::cout;
  using std::cin;
  using std::string;
  using std::numeric_limits;
  
  
  int size_of( int ); //------------------------------------------------- :62
  
  enum STR_TO_INT_STATUS { SUCCESS, OVERFLOW, UNDERFLOW, INCONVERTIBLE };
  
  STR_TO_INT_STATUS str_to_int( int&amp;, char const*, int ); //------------- :84
  
  
  int main()
    {
     int num;
     string str;
     string dummy;
     STR_TO_INT_STATUS code;
  
     system( "clear" );
  
     cout &lt;&lt; "\nint's max limit: "
          &lt;&lt; numeric_limits&lt;int&gt;::max()
          &lt;&lt; "\nint's min limit: "
          &lt;&lt; numeric_limits&lt;int&gt;::min()
          &lt;&lt; "\n\nnumber of digits in the largest int: "
          &lt;&lt; size_of( numeric_limits&lt;int&gt;::max() )
          &lt;&lt; "\nnumber of digits in the smallest int: "
          &lt;&lt; size_of( numeric_limits&lt;int&gt;::min() );
  
     cout &lt;&lt; "\nEnter a string containing numbers: ";
  
     cin &gt;&gt; str;
  
     code = str_to_int( num, str.c_str(), 0 );
  
     if( code == OVERFLOW || code == UNDERFLOW )
       cout &lt;&lt; "\nThe number was out of int's range\n\n";
     else if( code == INCONVERTIBLE )
            cout &lt;&lt; "\nThe string contained non-number characters\n\n";
          else if( code == SUCCESS )
                 cout &lt;&lt; "\nThe int version of the string is: " &lt;&lt; num &lt;&lt; "\n\n";
  
     cout &lt;&lt; "Press enter key to continue...";
  
     getline( cin, dummy );
  
     system( "clear" );
  
     return( 0 );
    }
  
  
  int size_of( int num )
    {
     int length = 0;
  
     num = ( int )fabs( num );
  
     if( num == 0 )
       length = 1;
     else
       while( num &gt; 0 )
         {
          length++;
  
          num /= 10;
         }
  
     return( length );
    }
  
  STR_TO_INT_STATUS str_to_int( int &amp;i, char const* s, int base )
    {
     char *end;
     long l;
     errno = 0;
  
     l = strtol( s, &amp;end, base );
  
     if( ( errno == ERANGE &amp;&amp; l == LONG_MAX ) || l &gt; INT_MAX )
       return OVERFLOW;
  
     if( ( errno == ERANGE &amp;&amp; l == LONG_MIN ) || l &lt; INT_MIN )
       return UNDERFLOW;
  
     if( *s == '\0' || *end != '\0' )
       return INCONVERTIBLE;
  
     i = l;
  
     return SUCCESS;
    }
  </code></pre>
  
  <p>I get the following compile errors:</p>
  
  <pre><code>int_limits.cpp:16: error: expected identifier before numeric constant
  int_limits.cpp:16: error: expected `}' before numeric constant
  int_limits.cpp:16: error: expected unqualified-id before numeric constant
  int_limits.cpp:16: error: expected `,' or `;' before numeric constant
  int_limits.cpp:16: error: expected declaration before '}' token
  </code></pre>
  
  <p>I've looked for spelling errors, tried moving the location of the enum line around... I dunno what in the world is going on.</p>
  
  <p>Any help with this issue would be GREATLY appreciated!</p>