Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c Subject: Re: Doctor C's Pointers Message-ID: <374@taumet.com> Date: 2 Aug 90 16:15:30 GMT References: <9@wotk.UUCP> Organization: Taumetric Corporation, San Diego Lines: 18 nickh@wotk.UUCP (Nick Hennenfent) writes: >( "abcd"[i] and f()[j] ) > ^^^^^ >I thought this was taboo. What's the story on this? In ANSI C, it's perfectly ok, as long as f() is declared to return a pointer type. Many earlier C compilers did not support this, however, and its portability was not guaranteed. Any conforming ANSI compiler must allow it. Similarly, if f() returns a struct type with member x, you could write f().x, and if f() returns a pointer to a function, you could write f()(). I make no comment on whether any of this is good programming practice. -- Steve Clamage, TauMetric Corp, steve@taumet.com