Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.lang.c Subject: Re: Pointer Trouble Right Here in Unix City Message-ID: <6123@umcp-cs.UUCP> Date: Tue, 28-May-85 17:46:11 EDT Article-I.D.: umcp-cs.6123 Posted: Tue May 28 17:46:11 1985 Date-Received: Thu, 30-May-85 02:42:54 EDT References: <179@gatech.CSNET> Distribution: net Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 31 ?: expressions should have compatible types on both sides of the : part. For example, g(x ? 1.0 : 0) is legal, with the result of the ?: expression being of type double. Mixing a pointer to a character and a pointer to a pointer to a character ``ain't strickly kosher''. The relevant quote from the ANSI draft is: C.3.15 Conditional operator Syntax conditional-expression: logical-OR-expression logical-OR-expression ? logical-OR-expression : conditional-expression Constraints: The first operand must have scalar type. The second and third operands may each have arithmetic type, or may each have void type, or may be structure objects, union objects, or pointers that have the same type. In addition, one may be a pointer and the other an integral constant expression with the value 0. [I left out the semantics description; ``constraints'' covers the original problem. The compiler is correct to complain.] -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@maryland