On Tue, Mar 25, 2008 at 4:32 AM, Robert Ryan <[EMAIL PROTECTED]> wrote:
>
>  this is the error I got:
>
> Hw4#4.cpp: In function `bool Chrono::is_date(int, Chrono::Date::Month, int)':
>  Hw4#4.cpp:56: warning: unreachable code at beginning of switch statement
>  /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0x18): In 
> function `_start':
>  ../sysdeps/i386/elf/start.S:77: undefined reference to `main'
>  collect2: ld returned 1 exit status

You have no uncommented case: statements in that switch - that's what
that's complaining about:

         bool is_date(int y, Date::Month m, int d)
         {
 // assume that y is valid
             if(d<=0) return false;
             int days_in_month = 31;
             switch(m) {
 // the length of February varies
 /*case Date::feb:
                 days_in_month = (leapyear(y))?29:28;
                 break;
                 case Date::apr: case Date::jun: case Date::sep: case Date::nov:
                 // the rest have 31*/
                 days_in_month = 30;
                 break;
                 if(days_in_month<d) return false;
                 return true;
             }
         }

Try and get an editor that syntax highlights your code. And try to
post indented code.


-- 
PJH

A man walks into a bakery, points and the girl behind the counter
"Is that a macaroon or a meringue?"
"No, you're right, it's a macaroon."

Reply via email to