Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!umigw!steve From: steve@umigw.MIAMI.EDU (steve emmerson) Newsgroups: comp.lang.c Subject: Re: swaps with arrays Message-ID: <112@umigw.MIAMI.EDU> Date: Mon, 14-Sep-87 10:06:34 EDT Article-I.D.: umigw.112 Posted: Mon Sep 14 10:06:34 1987 Date-Received: Tue, 15-Sep-87 05:07:03 EDT References: <2376@zeus.TEK.COM> <110@umigw.MIAMI.EDU> <1361@dataio.Data-IO.COM> Reply-To: steve@umigw.UUCP (steve emmerson) Organization: University of Miami Lines: 39 Summary: summary/analysis of a leaning experience Let me try to summarize what I think I've learned: 1) There is some miscommunication going on because some of us are talking about generic *routines* while others are talking about generic *macros*. (I'm guilty of thinking about the former while listening about the latter -- sigh). 2) In the case of a generic macro, I now agree that the semantics of a macro must necessarily be constrained by the language in which it is written (which should be obvious) and, therefore, it is unrealistic to ask a generic macro to to something which the language does not allow (e.g., using array arguments in a swap macro). When writing generic *macros*, it is ligitimate to expect the user to understand the limitations of the language. Thus, un-&-able or unmodifiable swap arguments are an obvious no-no. The pitfall here is *remembering* that that undistinguished, lower-case routine is actually a macro. 3) In the case of a generic *routine*, I believe there is no reason to assume that its semantics would necessarily be contrained by the language of the *calling* routine (forgive me Walter, I misunderstood your original posting -- I thought you were talking about this). C programs are full of I/O routines, about whose semantics C knows nothing. Also, it is possible (on some machines) to write a routine in a totally separate language and have it do things C can only dream about (to wax poetic for a second). I still believe generic *routines* are instatiations of abstract algorithms and are (or at least should be) unconstrained. 4) This whole issue has become *almost* moot (register variables, `consts', bitfields, etc -- sigh) since David Goodenough <343@wrs.UUCP> posted his macro/sub-routine hybrid which allows the use of array arguments without the need for an explicit length argument. Gosh this was (continues to be?) fun! -- Steve Emmerson DDN: emmerson@miami.miami.edu SPAN: miami::emmerson (host 3.2) emmerson%miami.span@star.stanford.edu UUCP: ...!hao!umigw!miami!emmerson emmerson%miami.span@vlsi.jpl.nasa.gov