RE: [sv-champions] 5-day email vote - 1556

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Wed Aug 29 2007 - 02:14:55 PDT
Hmmm,

Well, actually, with the illegal statement, the entire thing would not
compile, so nothing would be printed. Your analysis assumes that loop3
of the 3rd loop is static, I guess based on the previous legal syntax.
Dave's comments assumed the statement is not there at all or has no
initializer. 

But the 3rd loop has no comment saying what would be printed, so your
original statement that "The comments in the example are wrong, because
they say 1 2 3 3 3 3 3 3 3 3 should be printed" is not really correct.
(You also had 1 too many 3's there.)

So those comments are not really correct as it stands, since the code
will not execute at all.

The following point also bothers me:

>   Although according to 6.7, "Setting the initial value of a 
> static variable as part of the variable declaration 
> (including static class
> members) shall occur before any initial or always blocks are 
> started.", the LRM does not specify the execution order of 
> static initializers.

I'm not sure we don't have a hole or at least a gotcha here.
At the very least, I don't think an example in the LRM should depend on
a specific execution order not specified by the LRM.

I don't think I can approve this proposal as it stands.

Shalom


> -----Original Message-----
> From: owner-sv-champions@server.eda.org 
> [mailto:owner-sv-champions@server.eda.org] On Behalf Of Brad Pierce
> Sent: Tuesday, August 28, 2007 7:05 PM
> To: sv-champions@server.eda.org
> Subject: RE: [sv-champions] 5-day email vote - 1556
> 
> Shalom,
> 
>   count is initialized to -1.
> 
>   loop3 of 2nd loop is initialized to -1 and count is 
> incremented to 0.
> 
>   loop3 of 3rd loop is initialized to 0 and count is incremented to 1.
> 
>   The initial block begins.
> 
>   The first loop executes, each time around triggering a call 
> to counter(). loop1 progresses through 1, 2, 3, causing count 
> to be incremented through 2, 3, 4, which values are printed 
> by the first series of $displays.
> 
>   The second loop executes with no effect on count, so each 
> time around it $displays 4's.
> 
>   The third loop executes, again with no effect on count, so 
> each time around it $displays some more 4's.
> 
>   Although according to 6.7, "Setting the initial value of a 
> static variable as part of the variable declaration 
> (including static class
> members) shall occur before any initial or always blocks are 
> started.", the LRM does not specify the execution order of 
> static initializers.
> Most implementations do these in source order.  I don't know 
> what happens in practice if they are in different modules, 
> especially on different command lines.
> 
> -- Brad
> 
> -----Original Message-----
> From: Bresticker, Shalom [mailto:shalom.bresticker@intel.com]
> Sent: Tuesday, August 28, 2007 2:26 AM
> To: Rich, Dave; Brad Pierce; sv-champions@eda.org
> Subject: RE: [sv-champions] 5-day email vote - 1556
> 
> Hi,
> 
> Regarding 1556: 
> 
> > >         4)  The example is confusing.
> > [DR] Not to me :)
> 
> I think more explanatory comments would be helpful, either as 
> code comments or as text before or after the example. I can 
> figure it out, but it takes some work. Other people might 
> have more trouble.
> 
> 
> > >         5)  The comments in the example are wrong, because
> > they say 1
> > 2
> > > 3 3 3 3 3 3 3 3 should be printed, but actually it should
> > be 2 3 4 4 4
> > 4
> > > 4 4 4
> > [DR] The results assumes the illegal statement is not executed. 
> > Perhaps that should be shown as a completely separate module. Would 
> > that be less confusing?
> 
> I am confused, because Brad asserts that the comments say 
> that 9 or 10 numbers should be printed, whereas I only see 
> two comments, one says "end // prints 1 2 3" and the other 
> says, "end // prints 3 3 3".
> 
> Where do the other 3 or 4 come from?
> I understand that there is an additional print task call. But 
> there is no comment saying what it will display.
> 
> And another question:
> There is an initialization of int at the top of the module:
> int count = -1; // static keyword not required
> 
> Afterwards, there is another initialization:
> static int loop3 = counter(); // static keyword required
> 
> where
> function int counter();
> return count++;
> endfunction
> 
> Is there something in the LRM that guarantees that the 
> initialization of count will occur before the initialization of loop3?
> 
> Finally, and this is not intended to suggest a modification 
> of this proposal, I think that 6.21 and 6.7 should xref each 
> other, as both talk about variable initialization. In 
> particular, 6.21 is missing the information about when this 
> occurs, which is relevant in this example.
> 
> I would also cross-reference between 9.2.1, which discusses 
> intial procedures, and 6.7, which discusses the scheduling of 
> variable initialization, particularly as this is different 
> than in 1364.
> 
> Thanks,
> Shalom
> 
> --
> 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 Aug 29 02:15:18 2007

This archive was generated by hypermail 2.1.8 : Wed Aug 29 2007 - 02:15:20 PDT