Path: utzoo!mnetor!uunet!husc6!hao!ames!pasteur!ucbvax!CORY.BERKELEY.EDU!dillon From: dillon@CORY.BERKELEY.EDU (Matt Dillon) Newsgroups: comp.sys.amiga Subject: Re: Amiga programmer's hint $14 Message-ID: <8803081925.AA08506@cory.Berkeley.EDU> Date: 8 Mar 88 19:25:28 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 15 >: char c = *(char *)&bar; LEGAL. (USEFUL?) >: >Yeah, useful in some cases, but can be also dangerous if you >hit odd addresses for ints and longs. >So a char foo[4]= {\{1, 2, 3, 4}; > > b= *(int *)foo+1; Yah, that's why I used *(char *) in my example. The proper way to cast to other types with possible alignment problems is to use a union, but you still have to be careful when overlaying structures on buffers (that caught me a couple of times!). -Matt