Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!ncar!boulder!bernard From: bernard@boulder.Colorado.EDU (Bernie Bernstein) Newsgroups: comp.sys.mac.programmer Subject: Think C ?: struct bug Message-ID: <29910@boulder.Colorado.EDU> Date: 17 Nov 90 02:10:31 GMT Sender: news@boulder.Colorado.EDU Organization: University of Colorado, Boulder Lines: 39 Nntp-Posting-Host: piper.colorado.edu Originator: bernard@piper.colorado.edu 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 */ } This same program compiles fine using an if statement: if (x) then id1 = id2; else id1 = id3; Is there any fix for this? Am I doing something wrong? Should I just wait for the next version? I can live without this operator, but I like using it to build macros. This worked when MY_TYPE was a long instead of a struct. -- o, ,, , | Bernie Bernstein | , ,, L>O/ \,/ \ ,| University of Colorado at boulder |/ \,,/ \ O./ ' / . `, / | office: (303) 492-8136 | / ` \ ,. ,/ / , ' | email: bernard@boulder.colorado.edu | / '' \