Re: About Union's question



On Apr 1, 8:40 am, CBFalconer <cbfalco...@xxxxxxxxx> wrote:
Robert Gamble wrote:

Can you provide the C&V that supports your claim of undefined
behavior given the no trap representation provision?

6.2.6.1:
... snip ...

[#7] When a value is stored in a member of an object of
union type, the bytes of the object representation that do
not correspond to that member but do correspond to other
members take unspecified values, but the value of the union
object shall not thereby become a trap representation.

This is saying that the value of the union as a whole is
not a trap, i.e. you can pass it to functions and so on.
It doesn't say that there won't be a trap if any particular
member of the union is selected.

6.5.2.3 Structure and union members

[#5] With one exception, if the value of a member of a union
object is used when the most recent store to the object was
to a different member, the behavior is
implementation-defined.70)

This text is not in C99. I suggest that if you are to use N869
as a reference then you double check things with N1124 before
posting.


.



Relevant Pages

  • Re: Warning comes when using Unions
    ... I have declared an Union as follows ... member of a structure with more than one named member may have incomplete ... The expression that specifies the width of a bit-field shall be an integer ... declarator. ...
    (comp.lang.c)
  • ATI driver compilation problem
    ... I tried the ATI driver as supplied by ATI and the one supplied by livna ... member `pgd' in something not a structure or union ... defaults to `int' in declaration of `drm_agp_module_stub' ...
    (Fedora)
  • Ati fglrx driver & cko1 ?
    ... argumento 1 de `pmd_offset' de tipo de puntero incompatible ... to `int' in declaration of `drm_agp_module_stub' ... member `free_memory' in something not a structure or union ...
    (Debian-User)
  • Ati fglrx driver & 2.6.11 kernel?
    ... Has any of you successfully compiled fglrx driver under 2.6.11 kernel? ... to `int' in declaration of `drm_agp_module_stub' ... member `free_memory' in something not a structure or union ...
    (Debian-User)
  • Re: union arrangement
    ... > When a value is stored in a member of an object of union type, ... > of the union object shall not thereby become a trap representation. ...
    (comp.lang.c)