RE: [sv-bc] "Assignment ... to a constant expression"

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Fri Apr 25 2008 - 15:06:03 PDT
> But since this whole discussion started with the fact that
initializers
> aren't required to be constant expressions any more, I don't think it
applies. 

I don't think it's a fact that any arbitrary non-constant expression can
be used as the initializer of a static variable.  Where does the LRM say
that?

In fact, "this whole discussion started with"

    http://www.eda-stds.org/sv-bc/hm/8587.html


in which I write 

   "Is this trying to say that in a variable_decl_assignment, if the
variable is static,
then the right-hand side shall be a constant expression?"

-- Brad

-----Original Message-----
From: Steven Sharp [mailto:sharp@cadence.com] 
Sent: Friday, April 25, 2008 2:33 PM
To: sv-bc@eda-stds.org; Brad.Pierce@synopsys.COM
Subject: RE: [sv-bc] "Assignment ... to a constant expression"


>From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of
>Bresticker, Shalom
>
>By the way, I just found the following example in 6.19.5.7:
>
>typedef enum { red, green, blue, yellow } Colors;
>Colors c = c.first;
>
>This indicates that the 'point of declaration' is before the
>initializing expression (as I would personally would expect).

Or at least that the person writing the example thought so.  Given that
the question has never been brought up and resolved in committee, I
don't think we can consider this example definitive.

It does point out a situation where the self-reference actually has a
useful purpose.


>From: "Brad Pierce" <Brad.Pierce@synopsys.com>
>
>Shalom,
>
>Would that initialization be legal for a static variable?  The question
>is related to
>
>    http://www.eda-stds.org/sv-bc/hm/8044.html

That email related to whether a built-in method call qualified as a
constant expression.  But since this whole discussion started with the
fact that initializers aren't required to be constant expressions any
more, I don't think it applies.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Apr 25 15:10:57 2008

This archive was generated by hypermail 2.1.8 : Fri Apr 25 2008 - 15:11:17 PDT