delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/23/15:19:08

From: "Andrew Jones" <luminous-is AT home DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <88v09h$64n$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
Subject: Re: rectification about switch ... such a big mistake
Lines: 28
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Message-ID: <YnVs4.72554$45.4010587@news2.rdc1.on.home.com>
Date: Wed, 23 Feb 2000 18:10:00 GMT
NNTP-Posting-Host: 24.42.120.18
X-Complaints-To: abuse AT home DOT net
X-Trace: news2.rdc1.on.home.com 951329400 24.42.120.18 (Wed, 23 Feb 2000 10:10:00 PST)
NNTP-Posting-Date: Wed, 23 Feb 2000 10:10:00 PST
Organization: @Home Network Canada
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

[snip]

>     switch (charact)
>            {
>             case 'A':
>             case 'M':
>                  check=1;
>            };
>     } while ((test!=1)||(check==0));

[snip]

I don't really understand the routine's purpose, but I think you might like to
put a break or two in there somewhere.

switch(charact)
  {
  case 'A': break; /* do nothing ?? */
  case 'M': check = 1; break; /* do something ?? */
  default: break; /* not required, but I always do it for completeness sake */
  } /* semi-colon at end of switch is not required */

Basically, even if A is pressed, your switch is "falling through" to what's
supposed to happen for 'M'.

AndrewJ


- Raw text -


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