delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/24/03:10:00

From: "J.A. Bijsterbosch" <bijster AT worldonline DOT nl>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: "jump to case label" message; please help me!
Date: 23 Mar 1998 18:28:23 GMT
Organization: Bijsterbosch Productions
Lines: 56
Message-ID: <01bd5647$0ca2bb20$LocalHost@none>
References: <35134F49 DOT C51C6867 AT geocities DOT com>
NNTP-Posting-Host: asd1-p79.worldonline.nl
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello Dan,

Dan Chak <chakster AT geocities DOT com> schreef in artikel
<35134F49 DOT C51C6867 AT geocities DOT com>...
> 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??

Hmm, I am to lazy to set something up to try your snippet, but two things
come to mind when seeing the below piece of code.
> 
>    int choice;
>    do {
>       choice = mainMenu->update();
>       switch (choice) {
>          case 2: 

in the following line you create a local variable and in that case (no pun
intended) you should put braces around such a case statement.

	   {
>             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;

Seeing your code this is something for Allegro isn't it? So why use delay,
try the rest() function from the Allegro lib and see if that's the
culperit. If you have installed the  Allegro timer, delay will break your
program if I recal correctly.

>             delay(2);
>             break;
>       }
>    } while (!choice);
> 
> Thanks,

Well I hope this helps... ;-))

> Dan Chak

-- 
Greetings from sunny Amsterdam,

    Jan Bijsterbosch

email: bijster AT worldonline DOT nl
http://home.worldonline.nl/~bijster

- Raw text -


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