🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Annotations on K&R II

#2575
From: ct
Date: Thu, 11 Apr 1996 23:51
23 lines
1680 bytes
In article <4k60bd$aa1@solutions.solon.com>,
Jerry Coffin <jcoffin@rmii.com> wrote:
 >In article <4jv6o8$coj@solutions.solon.com>, 
 >schwarz@mips.complang.tuwien.ac.at says...
 >> 
 >> My understanding is that a conversion to a (void *) followed by a conversion
 >> to the original pointer type is the identity mapping; in other words, the
 >> mapping a C compilers uses between (void *) and any other pointer type is
 >> bijective.
 >
 >Hmm...I'm not sure what "bijective" means (my dictionary doesn't include it) 
 >the basic idea here seems to be correct: "A pointer to any incomplete or 
 >object type may be converted to a pointer to void and back again; the result 
 >shall compare equal to the original pointer."  ($6.2.2.3)

Actually, he's mistaken about the "bijective" bit, the map is only
"injective". Bijective means the mapping is two-way on both domains,
ie a cast from a (Type *) to a (void *) can be cast back (true) _and_
that a cast from a (void *) to a (Type *) can be cast back (generally
false). (Since the mapping from (Type *) to (void *) is injective, it
follows that the mapping from (void *) to (Type *) is surjective.)

regards, ct
Technical Details
Message-ID: <4kk5uf$g8a@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4jq1eq$a3c@solutions.solon.com> <4jr73o$h87@solutions.solon.com> <4jv6o8$coj@solutions.solon.com> <4k60bd$aa1@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: ct@ecs.ox.ac.uk (ct)
Newsgroups: comp.lang.c.moderated
Subject: Re: Annotations on K&R II
Date: 11 Apr 1996 18:51:43 -0500
Organization: Oxford University
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4kk5uf$g8a@solutions.solon.com>
References: <4jq1eq$a3c@solutions.solon.com> <4jr73o$h87@solutions.solon.com> <4jv6o8$coj@solutions.solon.com> <4k60bd$aa1@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com