Sam Dennis <> wrote in message news:<>...
> Gregory Pietsch wrote:
> > void myswap(unsigned long a,unsigned char *b,unsigned char *c)
>
> Not size_t a?
It probably comes later on in K&R2, or was a brain cramp on my fault.
>
> > {
if (b != c)
> > while (a--) {
> > *b ^= *c;
> > *c ^= *b;
> > *b++ ^= *c++;
> > }
> > }
>
> That's a really bad idea; not only does it fail to deal with the two
> values being the same, but, should they share a single byte of their
> respective representations, it has undesirable behaviour for the few
> types where it's undefined at all.
Then how would you actually accomplish this?