On Thu, 11 Apr 2002, Bob Ammerman wrote: > > > > > (((union lo_hi) eth_length).b.l) = ....; // assign low byte > > > > CCS won't compile this statement - it says it is looking for a close > > paren. > > I didn't know you could cast to a union or a structure, and the limited > > references I have handy don't talk about it. Am I understanding your > > suggestion correctly? > > No, you can't cast a union or structure, but you can cast a pointer to one. Interesting. gcc *will* cast a union as long as one of the elements in the union is of the same type of the object being cast. E.g.: union i_c { int i; char c; }; ... unsigned int ui; int i; char c; ... c = ((union i_c)i).c; // not an error c = ((union i_c)ui).c; // error -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu