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

From: Bresticker, Shalom <shalom.bresticker@intel.com>
Date: Wed Jun 02 2010 - 03:52:06 PDT

I agree. I think the LRM is clear that there is in actuality only one loop and only one scope.
It only "corresponds" or "is similar" (the terms actually used by the LRM) to nested for loops.

Shalom

> -----Original Message-----
> From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On
> Behalf Of Daniel Mlynek
> Sent: Wednesday, June 02, 2010 1:31 PM
> 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.
>
>
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

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

This archive was generated by hypermail 2.1.8 : Wed Jun 02 2010 - 03:55:23 PDT