Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!sri-spam!ames!ucbcad!zen!cory.Berkeley.EDU!waterman From: waterman@cory.Berkeley.EDU.UUCP Newsgroups: comp.sys.amiga Subject: Re: Aztec C bug Message-ID: <4993@zen.berkeley.edu> Date: Thu, 19-Nov-87 05:25:24 EST Article-I.D.: zen.4993 Posted: Thu Nov 19 05:25:24 1987 Date-Received: Sat, 21-Nov-87 14:04:35 EST References: <532@oscvax.UUCP> Sender: news@zen.berkeley.edu Reply-To: waterman@cory.Berkeley.EDU.UUCP (T.S. Alan Waterman) Distribution: na Organization: University of California, Berkeley Lines: 33 Keywords: C structs manx bugs Summary: not a real bug. rico@oscvax.UUCP (Rico Mariani) writes: > > main() > { > struct foo { int x; } bar; > > if (bar) ; > } > > compiles to: No. The only compiler bug here is that it didn't give you a big flaming error message (multiple lines, ^'s and all, Mike :^). This is a program bug, not a compiler bug. bar, being a structure, is not allowed as an argument to if(). bar cannot be zero, non-zero, or anything else. It is a label for a structure. The only legal thing you can do here is to say: if (bar.x); What you have written really can't be said in C. C is a strange mixture of high level and very-low level programming constructs, and as such it can get you into some severe trouble. Hope this clears this one up. Happy bug-hunting !-) ---TS