Generic swap - comments and questions

Bryon Lape wozniak at utkux1.utk.edu
Tue Jun 12 22:06:37 AEST 1990


	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-



More information about the Comp.std.c mailing list