Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #9969

Another Union question

From Quentin Pope <qp19433@hotmail.NOSPAM.com>
Newsgroups comp.lang.c
Subject Another Union question
Date 2011-09-06 21:01 +0000
Organization Aioe.org NNTP Server
Message-ID <j461mk$pcu$1@speranza.aioe.org> (permalink)

Show all headers | View raw


We know that &struct is equiv to &struct.firstMember. So far so good.

Now I have an union
union r32{
   uint8       l;
   uint16      x;
   uint32      val;

};

union  r32   reg;

and a function
void   f(union r32*  a){a->x=1;}

then

is to do   f(&reg.x) or f(&reg.l) or f(&reg.val) OK or not?
is it   &reg.x=&reg.l=&reg.val ?

Or I have to do f(&reg)?

Back to comp.lang.c | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Another Union question Quentin Pope <qp19433@hotmail.NOSPAM.com> - 2011-09-06 21:01 +0000
  Re: Another Union question James Kuyper <jameskuyper@verizon.net> - 2011-09-06 17:44 -0400
    Re: Another Union question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-07 02:08 +0100
      Re: Another Union question James Kuyper <jameskuyper@verizon.net> - 2011-09-07 08:04 -0400
    Re: Another Union question Keith Thompson <kst-u@mib.org> - 2011-09-06 18:33 -0700

csiph-web