Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > continue with switch

Reply
Thread Tools

continue with switch

 
 
Flash Gordon
Guest
Posts: n/a
 
      05-12-2006
v4vijayakumar wrote:
> break/continue inside loop means
> break-the-loop/continue-next-iteration, but inside switch (as it is not
> associated with any looping) both could mean same thing, that is
> execute-the-statement-next-to-switch.


No, a continue has no meaning in a switch.

> am directly posting from google groups. can you please let me know,
> what tool people generally use to read/post to groups. TIA.


Almost and news client is better than Google, even Outlook Express,
although personally I use Thundirbird, I've also used Agent and
Sylpheed. Ask you ISP for details of your news server or search for a
free or pay for server.

However, when posting using Google is *is* possible to provide context,
so please do so. See the information about Google at and linked from
http://clc-wiki.net/wiki/Intro_to_clc
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro:
http://clc-wiki.net/wiki/Intro_to_clc
 
Reply With Quote
 
 
 
 
Bart Rider
Guest
Posts: n/a
 
      05-12-2006
pete wrote:
> Bart Rider wrote:
>
>>v4vijayakumar wrote:
>>
>>>'continue' within switch actually associated with the outer 'while'
>>>loop. Is this behavior protable?
>>>

>

[...skip...]
>
> /* BEGIN new.c */
>
> #include <stdio.h>
>
> int main(void)
> {
> int ch = 'a';
> int i = 0;
>
> while (1) {
> ++i;
> switch(ch) {
> case 'a': printf("i=%d, a\n",i); ch='b'; continue; break;
> case 'b': printf("i=%d, b\n",i); ch='c'; continue;
> default: return 0;
> }
> }
> return 0;
> }
>
> /* END new.c */
>
>


Was a little bit misleaded by my code.
No I see clear. Thanks for opening my eyes.

Bart
 
Reply With Quote
 
 
 
 
CBFalconer
Guest
Posts: n/a
 
      05-12-2006
v4vijayakumar wrote:
>

.... snip ...
>
> am directly posting from google groups. can you please let me know,
> what tool people generally use to read/post to groups. TIA.


Google groups is a very poor interface to Usenet. You can use the
methods described below in my sig. However you would be well
advised to install a real newsreader (such as Thunderbird from
mozilla.org) and access news directly through your ISP and a
newsserver. Most ISPs supply a newserver.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>

 
Reply With Quote
 
void * clvrmnky()
Guest
Posts: n/a
 
      05-12-2006
Bart Rider wrote:
> Richard Bos wrote:
>> "v4vijayakumar" <(E-Mail Removed)> wrote:
>>
>>
>>> 'continue' within switch actually associated with the outer 'while'
>>> loop. Is this behavior protable?
>>>
>>> int ch = '\n';
>>> while (true) {
>>> switch(ch) {
>>> case '\n': cout << "test"; continue;
>>> }
>>> }

>>
>>
>> I have no idea if it's portable under C++, which is what your code
>> actually is. In this newsgroup we discuss ISO C, and yes, in that
>> language any continue statements do not apply to a switch statement, but
>> to the continue's closest surrounding loop statement, if there is any.
>>
>> Richard

>
> really?
> Any break inside a switch statement is actually assigned to the
> switch statement (it leaves the choice statement switch and continues
> with the first statement after switch) and not for any surrounding loop.
> The same applies to continue IMHO.


Nope. continue only applies to loops.
 
Reply With Quote
 
Andrew Poelstra
Guest
Posts: n/a
 
      05-12-2006
On 2006-05-12, CBFalconer <(E-Mail Removed)> wrote:
> v4vijayakumar wrote:
>>

> ... snip ...
>>
>> am directly posting from google groups. can you please let me know,
>> what tool people generally use to read/post to groups. TIA.

>
> Google groups is a very poor interface to Usenet. You can use the
> methods described below in my sig. However you would be well
> advised to install a real newsreader (such as Thunderbird from
> mozilla.org) and access news directly through your ISP and a
> newsserver. Most ISPs supply a newserver.
>


Just out of curiousity, have you ever had problems with Thunderbird
locking up? Whenever a large batch of messages came in, the
program would stop working permanently and require me to delete all
my mail files. I was using FC5.

Now I just use slrn, and I highly recommend it. The only issue I
have encountered is that I need to do my own line wrapping.
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      05-12-2006
Andrew Poelstra wrote:
> On 2006-05-12, CBFalconer <(E-Mail Removed)> wrote:
>> v4vijayakumar wrote:
>>>

>> ... snip ...
>>>
>>> am directly posting from google groups. can you please let me know,
>>> what tool people generally use to read/post to groups. TIA.

>>
>> Google groups is a very poor interface to Usenet. You can use the
>> methods described below in my sig. However you would be well
>> advised to install a real newsreader (such as Thunderbird from
>> mozilla.org) and access news directly through your ISP and a
>> newsserver. Most ISPs supply a newserver.

>
> Just out of curiousity, have you ever had problems with Thunderbird
> locking up? Whenever a large batch of messages came in, the
> program would stop working permanently and require me to delete all
> my mail files. I was using FC5.


Well, I actually use Netscape 4.75 for mail and news, because I
consider it better than T'bird for my purposes.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>

 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      05-12-2006
CBFalconer wrote:

> v4vijayakumar wrote:
> >

> ... snip ...
> >
> > am directly posting from google groups. can you please let me know,
> > what tool people generally use to read/post to groups. TIA.

>
> Google groups is a very poor interface to Usenet. You can use the
> methods described below in my sig. However you would be well
> advised to install a real newsreader (such as Thunderbird from
> mozilla.org) and access news directly through your ISP and a
> newsserver. Most ISPs supply a newserver.


Many ISPs these days have dropped usenet access, notably AOL. Mostly
dial-ups (in the US) have gotten rid of it, but some broadband
providers. If the OP is unable to get it from the ISP, then either a
free news service (I don't personally know of any) or a for-pay one
will be needed. I use news.individual.net, it costs 10 euro per year,
about $13 US.



Brian
 
Reply With Quote
 
Andrew Poelstra
Guest
Posts: n/a
 
      05-12-2006
On 2006-05-12, Default User <(E-Mail Removed)> wrote:
> CBFalconer wrote:
>
>> v4vijayakumar wrote:
>> >

>> ... snip ...
>> >
>> > am directly posting from google groups. can you please let me know,
>> > what tool people generally use to read/post to groups. TIA.

>>
>> Google groups is a very poor interface to Usenet. You can use the
>> methods described below in my sig. However you would be well
>> advised to install a real newsreader (such as Thunderbird from
>> mozilla.org) and access news directly through your ISP and a
>> newsserver. Most ISPs supply a newserver.

>
> Many ISPs these days have dropped usenet access, notably AOL. Mostly
> dial-ups (in the US) have gotten rid of it, but some broadband
> providers. If the OP is unable to get it from the ISP, then either a
> free news service (I don't personally know of any) or a for-pay one
> will be needed. I use news.individual.net, it costs 10 euro per year,
> about $13 US.
>


I can't imagine anyone on c.l.c who uses AOL, but I've been
surprised before.
 
Reply With Quote
 
Flash Gordon
Guest
Posts: n/a
 
      05-12-2006
Default User wrote:
> CBFalconer wrote:
>
>> v4vijayakumar wrote:
>> ... snip ...
>>> am directly posting from google groups. can you please let me know,
>>> what tool people generally use to read/post to groups. TIA.

>> Google groups is a very poor interface to Usenet. You can use the
>> methods described below in my sig. However you would be well
>> advised to install a real newsreader (such as Thunderbird from
>> mozilla.org) and access news directly through your ISP and a
>> newsserver. Most ISPs supply a newserver.

>
> Many ISPs these days have dropped usenet access, notably AOL. Mostly
> dial-ups (in the US) have gotten rid of it, but some broadband
> providers. If the OP is unable to get it from the ISP, then either a
> free news service (I don't personally know of any) or a for-pay one
> will be needed. I use news.individual.net, it costs 10 euro per year,
> about $13 US.


There is a news group about free news servers...

Also I know of a couple of free servers.
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro:
http://clc-wiki.net/wiki/Intro_to_clc

Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
 
Reply With Quote
 
tedu
Guest
Posts: n/a
 
      05-12-2006
Bart Rider wrote:

> Any break inside a switch statement is actually assigned to the
> switch statement (it leaves the choice statement switch and continues
> with the first statement after switch) and not for any surrounding loop.
> The same applies to continue IMHO.


did you try it?

void foo(int x) {
switch (x) {
case 0: continue;
case 1: break;
}
}

t.c: In function 'foo':
t.c:3: error: continue statement not within a loop

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
do{switch(0)default:{/*break or continue*/;}/*cleanup*/}while(0); Francois Grieu C Programming 55 07-30-2011 11:30 AM
There is no "continue" for switch? xz C++ 13 03-19-2008 05:21 AM
switch/continue Christopher Benson-Manica C Programming 4 06-08-2004 04:03 PM
bridge / layer 2 switch / layer 3 switch Joel M. Baldwin Cisco 2 11-06-2003 11:19 PM
difference b/w layer 2 switch and layer 3 switch praveen Cisco 1 10-22-2003 07:19 AM



Advertisments