Article View: comp.lang.c.moderated
Article #2586Re: void* type
From: Mike McCarty
Date: Sat, 13 Apr 1996 13:56
Date: Sat, 13 Apr 1996 13:56
40 lines
1880 bytes
1880 bytes
In article <4jtteu$3lc@solutions.solon.com>,
Lawrence Kirby <fred@genesis.demon.co.uk> wrote:
)In article <4jq1e4$a2g@solutions.solon.com>
) David_McReynolds@vos.stratus.com "David McReynolds" writes:
)
)>Perhaps I'm confused but when I read the question this is what I came
)>up with. It compiles and worked as expected in a test case.
)>
)>As far as the two pointers to be swapped are concerned, they are of
)>the same type correct?
)>
)>I do not see the problem with:
)>
)>void swap_ptr(void **p1, void **p2) {
)> void *tmp = *p1;
)>
)> *p1 = *p2;
)> *p2 = tmp;
)>
)> return;
)>}
)
)This swaps 2 void * pointers, it isn't guaranteed to swap any other type
)of pointer (except possibly char *). There is no guarantee that any other
)pointer has the same size or representation as void * (except char *).
This thread has some real silly stuff in it. Especially "is there a
machine still in use with different function/char/other pointers?"
The IBM PC when building using any 16 bit compiler using either Medium
or Compact Model has different size function and data pointers.
I think there are at least a FEW of those computers still out there.
Mike
--
----
char *p="char *p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
I don't speak for DSC. <- They make me say that.
Technical Details
Message-ID:
<4kobq8$8gu@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<4iepre$ag7@solutions.solon.com> <4ja3qf$p9b@solutions.solon.com> <4jq1e4$a2g@solutions.solon.com> <4jtteu$3lc@solutions.solon.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: jmccarty@sun1307.spd.dsccc.com (Mike McCarty) Newsgroups: comp.lang.c.moderated Subject: Re: void* type Date: 13 Apr 1996 08:56:24 -0500 Organization: DSC Communications Corporation Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <4kobq8$8gu@solutions.solon.com> References: <4iepre$ag7@solutions.solon.com> <4ja3qf$p9b@solutions.solon.com> <4jq1e4$a2g@solutions.solon.com> <4jtteu$3lc@solutions.solon.com> NNTP-Posting-Host: solutions.solon.com