www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/21/11:37:12

Message-ID: <3513EC92.AEA5E9A1@geocities.com>
Date: Sat, 21 Mar 1998 11:36:34 -0500
From: Dan Chak <chakster AT geocities DOT com>
MIME-Version: 1.0
To: Scott Warner <swarnerx3 AT acadia DOT net>
CC: djgpp AT delorie DOT com
Subject: Re: "jump to case label" message; please help me!
References: <35134F49 DOT C51C6867 AT geocities DOT com> <351398AC DOT 504F AT acadia DOT net>

Scott Warner wrote:
> 
> Dan Chak wrote:
> >
> > I have the following code in a program of mine which (to me) seems to be
> > harmless.  However, I get an error with DJGPP that says "Error: Jump to
> > case label" for the line that reads "case 3:".  Can anyone help me
> > figure out why??
> >
> >    int choice;
> >    do {
> >       choice = mainMenu->update();
> >       switch (choice) {
> >          case 2:
> >             BITMAP * card = load_pcx("10d.pcx", myPal);
> >             show_mouse(NULL);
> >             masked_blit(card, screen, 0, 0, 50, 50, 115, 177);
> >             show_mouse(screen);
> >             delete card;
> >             choice = 0;
> >             break;
> >          case 3:
> >             delete mainMenu;
> >             delay(2);
> >             break;
> >       }
> >    } while (!choice);
> >
> > Thanks,
> > Dan Chak
> > chakster AT geocities DOT com
> 
> Generally, I think it's good practise to put in a default: label.  What
> happens if choice is 0 in this example?  I haven't coded this, so I
> don't know if the missing default: is the problem.

It should do nothing if it was anything but what's up there, but I put
in a default just to see if it would fix it (it didn't).  What's strange
is that it worked fine when I only had case 2 but no case 3.  This is
just something I'm using to test get familiar with Allegro, as I'm just
starting to use it, and it's ironic that a hidden syntax problem is
holding me back.

Thanks,
Dan Chak
chakster AT geocities DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019