Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!think!barmar From: barmar@think.COM (Barry Margolin) Newsgroups: comp.lang.c Subject: Re: swaps with arrays Message-ID: <8228@think.UUCP> Date: Wed, 9-Sep-87 17:41:54 EDT Article-I.D.: think.8228 Posted: Wed Sep 9 17:41:54 1987 Date-Received: Fri, 11-Sep-87 05:33:17 EDT References: <2376@zeus.TEK.COM> <110@umigw.MIAMI.EDU> Sender: news@think.UUCP Reply-To: barmar@godot.think.com.UUCP (Barry Margolin) Organization: Thinking Machines Corporation, Cambridge, MA Lines: 29 In article <110@umigw.MIAMI.EDU> steve@umigw.UUCP (steve emmerson) writes: >Well, I can't speak for everyone ;-), but if I was given a generic swap >routine that only worked on a subset of all possible data types ... >well, I might consider it very useful, but I wouldn't consider it >generic. Someone please correct me if I'm wrong, but I believe a >"generic" routine is one that will work for any type of input (with a >caveat for the above example that the two arguments have the same >type). Now, in the original article, Walter Bright had the word >"generic" in quotes. Perhaps he was thinking along these lines and >ment to imply a "pseudo" or "quasi" generic routine (Walter?). Several people have mentioned that the answer is that array names are constants. My point of view on this subject, and I think it directly addresses the point quoted above, is that the "genericity" of the swap macro is consistent with the rest of the language. In C assignment is generic, but you cannot use an array name as the target of an assignment. I don't know why anyone would expect anything in C to automatically operate element-wise on an array, as it happens in no other situation. I'm not an experienced C programmer (although I know it well enough that I knew why 'if *buffer == *"LDA"' was wrong in the recent query), but I would expect such people to be SURPRISED when things automatically handle arrays! --- Barry Margolin Thinking Machines Corp. barmar@think.com seismo!think!barmar