🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2479

Generic swap function (was: Re: void* type)

#2479
From: Lars Wirzenius
Date: Wed, 03 Apr 1996 13:11
17 lines
1346 bytes
watzka@stat.uni-muenchen.de (Kurt Watzka):
> If this is not the case, you cannot write such a function using pointers
> to pointers. You can still write a generic swap(), but it takes two
> void pointers as it's arguments, and it has an additional "size" 

Actually, you can't, since you can't pass a pointer to a variable
that has been defined with "register"...  But if you don't pass a
pointer, you can't swap arrays.  Therefore, you can't write a generic
swap function or macro.  (The FAQ may say something about this.)

My Publib function library has a anything-but-register-variables
swap function, of course. :-)

-- 
Lars Wirzenius <liw@iki.fi> <wirzeniu@kruuna.helsinki.fi>
MIME and PGP mail welcome.  Key: finger @kruuna, or check keyservers.
Publib http://www.iki.fi/liw/publib/
Technical Details
Message-ID: <4jttef$3ku@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4iepre$ag7@solutions.solon.com> <4ii34g$nlp@solutions.solon.com> <4ja3qf$p9b@solutions.solon.com> <4jckqc$a5o@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: wirzeniu@cc.helsinki.fi (Lars Wirzenius)
Newsgroups: comp.lang.c.moderated
Subject: Generic swap function (was: Re: void* type)
Date: 3 Apr 1996 07:11:43 -0600
Organization: University of Helsinki
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4jttef$3ku@solutions.solon.com>
References: <4iepre$ag7@solutions.solon.com> <4ii34g$nlp@solutions.solon.com> <4ja3qf$p9b@solutions.solon.com> <4jckqc$a5o@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com