Path: utzoo!utgpu!watserv1!ria!csd.uwo.ca!webber From: webber@csd.uwo.ca (Robert E. Webber) Newsgroups: comp.os.minix Subject: Re: C SYNTAX QUESTION Message-ID: <2171@ria.ccs.uwo.ca> Date: 4 Feb 91 03:51:43 GMT References: <43415@nigel.ee.udel.edu> <1991Feb1.155656.27244@mozart.amd.com> Sender: news@ria.ccs.uwo.ca Organization: see disclaimer Lines: 36 In article <1991Feb1.155656.27244@mozart.amd.com> tim@amd.com (Tim Olson) writes: .In article <43415@nigel.ee.udel.edu> HBO043%DJUKFA11.BITNET@cunyvm.cuny.edu (Christoph van Wuellen) writes: .| Is this correct, and if so, why? .| test() .| { .| int i; .| void void_function(); .| ... .| i ? void_function() : 0; .| } .| .| In GNU GAS, file obstack.h, many macros of such type are declared, and .| my c68/c386 compiler complains about that.. . .Yes, it should. void and int are incompatible types. The gcc compiler has no problem with this mixture of void with non-void (sort of metaphysical, ain't it). Of course, gcc is pre-ANSI. It seems that an ANSI compiler should complain, for example, if you compiled the above with gcc with both the options -ansi and the options -pedantic, then it would issue a warning. Gcc appears to be using a rule that is a bit more general than the ANSI table of chaos for the conditional expressions. In general, gcc tends to be a bit more orthogonal in its interpretation of the semantics of various constructs than other C compilers. Unfortunately, the ANSI people don't seem to have picked up on this even though the GNU compiler was out long before the ANSI specs. For that matter, Harbison & Steele seems to ignore the GNU compiler as it surveys C compiler variations. With the GNU compiler et al being ported to those Minix systems that have the memory to support it, we will doubtless being seeing more of these variances over time. If the GNU project has ANSI compliance as part of their coding goals, then it would be worthwhile mentioning this problem with GAS source to them. --- BOB (webber@csd.uwo.ca)