RE: [sv-bc] Some query related with enum.

From: Rich, Dave <Dave_Rich_at_.....>
Date: Mon Aug 25 2008 - 18:00:10 PDT
> 
> The issue of the values being outside the representable range is less
> clear.  Does this include values that change meaning based on whether
> they are regarded as signed or unsigned?  Or does it only include
values
> that lose significant bits due to truncation?  The LRM does not say.
> 
> Case 4 is illegal regardless of your interpretation.  The value is
signed
> and the enum is signed, and for a signed number, truncation of 3 to 2
bits
> loses a significant bit: the sign bit in the truncated result does not
> match the original sign bit.
> 
> Cases 2 and 3 do not do any truncation, so they cannot be losing any
> significant bits.  Only the interpretation of the bit pattern changes
when
> it is regarded as signed rather than unsigned.  I don't think the LRM
text
> is clear on whether this is valid or not.
[DR] I believe the constant expression used to define a named value is
evaluated in the context of an assignment to the base enum type. If you
make that assumption (what other choices are there?), all of the other
issues should drop out.

Dave


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Aug 25 18:00:43 2008

This archive was generated by hypermail 2.1.8 : Mon Aug 25 2008 - 18:01:14 PDT