Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!ub!uhura.cc.rochester.edu!rochester!pt.cs.cmu.edu!henry!hairston From: hairston@henry.ece.cmu.edu (David Hairston) Newsgroups: comp.sys.mac.programmer Subject: Re: Think C ?: struct bug Message-ID: Date: 17 Nov 90 18:26:39 GMT References: <29910@boulder.Colorado.EDU> Organization: Gaia II Lines: 29 In-reply-to: bernard@boulder.Colorado.EDU's message of 17 Nov 90 02:10:31 GMT [bernard@boulder.Colorado.EDU (Bernie Bernstein) writes:] [] I don't know if this is common knowledge, but I found a bug in the [] Think C compiler concerning the ?: operator and structs. It doesn't [] accept the following program segment: [] [] ... [] [] typedef struct { [] long a; [] long b; [] } MY_TYPE; [] [] ... [] [] foo(short x) [] { [] MY_TYPE id1,id2,id3; [] [] id1 = x ? id2 : id3; /* Illegal operation on struct/union */ my guess is that you've declared id1 to have allocated space and so you can't change it's address as implied above. i believe you want: MY_TYPE *id1, id2, id3; ... id1 = x ? &id2 : &id3; -dave- hairston@henry.ece.cmu.edu