Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!mcvax!unido!tub!net From: net@tub.UUCP (Oliver Laumann) Newsgroups: comp.lang.c Subject: Re: Davidsen's device Message-ID: <888@tub.UUCP> Date: 4 Aug 89 12:59:08 GMT References: <1430@crdgw1.crd.ge.com> Reply-To: net@tub.UUCP (Oliver Laumann) Organization: Technical University of Berlin, Germany Lines: 26 In article <1430@crdgw1.crd.ge.com> davidsen@crdos1.UUCP (bill davidsen) writes: > I recently discovered the following technique. While I can't swear > that it's new and unique to me, I can claim independent discovery. I > make no claims that it is suited to any problem you have, will have, or > would admit to having. > > (*(asect < 1.0 ? hacs2 : hacs1)(asect); This is quite a common idiom, I have used it lots of times (without the syntax error in your example, of course). You can even omit the * since it's superfluous. Or is it? Our K&R (the old edition) doesn't seem to say anything about this, but "gnucc -pedantic -ansi" doesn't complain about the following program (a good heuristic for checking whether it's valid C): int g() { return 5; } int foo() { int (*f)() = g; return f(); } -- Oliver Laumann net@TUB.BITNET net@tub.UUCP