But the standard should be revised to explicitly allow enums in packed structs, as it already does in packed arrays. You can indirectly do that anyway, by giving the packed struct a member that is a 1-element packed array that is an enum.
Shalom
From: Rich, Dave [mailto:Dave_Rich@mentor.com]
Sent: Friday, June 22, 2012 09:14
To: Bresticker, Shalom; Greg Jaxon
Cc: Surya Pratik Saha; sv-bc@eda.org
Subject: RE: [sv-bc] RE: Enum assignment via packed struct
Not to rub more salt into the wound<http://idioms.thefreedictionary.com/rub+salt+into+wounds>, but this is one more side-effect of fixing 'int's at 32-bits. When the sizes of int's and few other data types including basic enums were implementation dependent, variables of those types were not allowed to be a part of a packed array or struct, so this issue did not exist..
Any packed data type is by definition an implicit union with an integral type whose size is the total number of bits in the packed type. It's really too late to prohibit enums from packed structs at this point as tools are far too lenient with the existing restrictions. We can only clarify where the type safety of an enum is lost so that tools can provide the appropriate warning mechanisms.
Dave
Mentor Graphics
---------------------------------------------------------------------
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.
Received on Fri Jun 22 00:46:21 2012
This archive was generated by hypermail 2.1.8 : Fri Jun 22 2012 - 00:46:27 PDT