Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ll-xn!mit-eddie!gatech!amd!markg From: markg@amd.UUCP (Mark Gorlinsky) Newsgroups: comp.lang.c Subject: Re: Returning a value from ?: Message-ID: <4057@amd.UUCP> Date: Mon, 1-Jun-87 19:28:28 EDT Article-I.D.: amd.4057 Posted: Mon Jun 1 19:28:28 1987 Date-Received: Wed, 3-Jun-87 03:47:05 EDT References: <7555@brl-adm.ARPA> Reply-To: markg@amd.UUCP (Mark Gorlinsky) Organization: Advanced Micro Devices Lines: 29 In article <7555@brl-adm.ARPA> DAVE%UWF.BITNET@wiscvm.wisc.EDU writes: > Next in line, I just (yesterday) got a copy of Turbo C, and was >trying out some old programs on it. It works mostly like a champ, but >I ran across a small bug. It goes like this: > > (f(a) * f(p) > 0) ? (a = p) : (b = p); > >... I got it to work by splitting up the ? : up into >an if ... else, but it worked w/o hitch under Lattice 3.0. Is the above >statement not valid C code? This is certainly proper use of the ternary operator "?:". I tried to make my TURBO C fail using your code fragment. It DIDN'T fail!! You must have something else wrong in you code, or you need to give us a better sample of the code! Did you try to isolate this statement? What memory model were you using? What options were set? Please give more information! -- Mark Gorlinsky - AMD Processor Products Division/APPS SQA UUCP: {decwrl,ihnp4,allegra}!amd!markg AT&T: (408) 982-7811 DISCLAIMER: My opinions are mine, not my employers.