Re: [sv-bc] 6.9.2 Equivalent types - question

From: Greg Jaxon <Greg.Jaxon_at_.....>
Date: Mon Nov 21 2005 - 10:26:52 PST
The relationship between Matching and Equivalence here could
be made clearer by changing 6.9.2(2) to say

"2) Anonymous enum, unpacked struct, or unpacked union types
     are Equivalent if and only if they are Matching."

Shalom is right that for these cases, Equivalence is /not/ weaker
than Matching.  These are the types for which our goal was to
provide "strong type checking", so for these, equivalence makes
no compromises and becomes as strong as exact matching.

Greg Jaxon
Synopsys DCSV

Bresticker, Shalom wrote:
> Hi,
> 
> I have a question on Matching types vs. Equivalent types.
> 
> 6.9.1(3) says,
> 
> "3) An anonymous enum, struct, or union type matches itself among data objects declared within the same declaration statement and no other data types.
> 
> struct packed {int A; int B;} AB1, AB2;// AB1, AB2 have matching types
> struct packed {int A; int B;} AB3;     // the type of AB3 does not match the type of AB1"
> 
> 
> 6.9.2(2) says,
> 
> "2) An anonymous enum, unpacked struct, or unpacked union type is equivalent to itself among data objects declared within the same declaration statement and no other data types.
> 
> struct {int A; int B;} AB1, AB2; // AB1, AB2 have equivalent types
> struct {int A; int B;} AB3;      // AB3 is not type equivalent to AB1"
> 
> 
> If we look at the two texts, it seems that the case described by 6.9.2(2) is included in 6.9.1(3). 6.9.2(2) relates only to unpacked structs and unions (ignoring enums for now), whereas 6.9.1(3) makes no distinction between unpacked and packed structs and unions.
> 
> The example of 6.9.1(3) is of packed structs, but the text makes no such restriction.
> 
> Since matching is stronger than equivalence, this seems strange.
> 
> Comments?
> 
> Thanks,
> Shalom
> 
>  
> Shalom Bresticker
> Intel Jerusalem LAD DA
> +972 2 589-6852
> +972 54 721-1033
> I don't represent Intel 
> 
> 
Received on Mon Nov 21 10:28:35 2005

This archive was generated by hypermail 2.1.8 : Mon Nov 21 2005 - 10:29:57 PST