Xref: utzoo comp.lang.c:29533 comp.std.c:3227 comp.lang.misc:5049 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!emory!utkcs2!wozniak From: wozniak@utkux1.utk.edu (Bryon Lape) Newsgroups: comp.lang.c,comp.std.c,comp.lang.misc Subject: Generic swap - comments and questions Message-ID: <1990Jun12.120637.19933@cs.utk.edu> Date: 12 Jun 90 12:06:37 GMT Sender: news@cs.utk.edu (USENET News System) Reply-To: wozniak@utkux1.utk.edu (Bryon Lape) Organization: University of Tennessee Computing Center, Knoxville Lines: 19 Thanks for the help in writing the generic swap routine. I did have a mistake in the letter. The secong time that the generic_swap() function was given (the header that is) should have read: generic_swap(void *a, void *b) Sorry for this oversight. I do have a couple of questions, though. First, one of the responses received used memcpy() to move the data around. This is fine if both items have the same length, but does not work of different lengths (such as two different size strings, say the names of two people). Is there anyway to build this routine so that it will change data no matter what the lengths are? Second, does anyone know if ANSI will add a generic swap function to the C library? Third, is it possible to write this better in machine language (80286)? Last, what of C++? Better to write it here? -bryon lape-