RE: [sv-bc] scope of break/continue within foreach loop

From: Rich, Dave <Dave_Rich@mentor.com>
Date: Wed Jun 02 2010 - 07:13:49 PDT

I agree 'break' should exit the foreach loop. But 'continue' should goto
the next iteration of the inner loop;

> -----Original Message-----
> From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of
> Daniel Mlynek
> Sent: Wednesday, June 02, 2010 3:31 AM
> To: 'Paul Graham'; 'sv-bc'
> Subject: RE: [sv-bc] scope of break/continue within foreach loop
>
> Imho break should break the whole loop any other hahviour would be
just
> hard to understand ie:
>
> module top;
> int arr[10][3];
> initial
> foreach (arr[i,j]) begin
> $display(i, j);
> if (i==2) break; //this breaks the foreach and finishes whole
tests
> end
> endmodule
>
> DANiel
>
> -----Original Message-----
> From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of
Paul
> Graham
> Sent: Tuesday, June 01, 2010 11:55 PM
> To: sv-bc
> Subject: [sv-bc] scope of break/continue within foreach loop
>
> A foreach statement with multiple variables is defined as equivalent
to a
> set of nested for loops. If a break statement is executed in the body
of
> a
> forever loop, does it break out of the innermost of these nested for
> loops,
> or does it break out of the outermost? Likewise for a continue
> statement.
> I guess it should be the outermost loop. Could this be clarified?
>
> Paul
>
> --
> This message has been scanned for viruses and dangerous content by
> MailScanner, and is believed to be clean.
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Jun 2 07:14:08 2010

This archive was generated by hypermail 2.1.8 : Wed Jun 02 2010 - 07:16:45 PDT