Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!ncar!boulder!bernard From: bernard@boulder.colorado.edu (Bernie Bernstein) Newsgroups: comp.sys.mac.programmer Subject: Think C ?: struct bug Message-ID: <29908@boulder.Colorado.EDU> Date: 17 Nov 90 02:06:24 GMT Sender: news@boulder.Colorado.EDU Organization: University of Colorado Lines: 38 Nntp-Posting-Host: 128.138.243.64 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. Bernie Bernstein bernard@boulder.colorado.edu BERNARDB@applelink.apple.com (303)492-8136