Article View: comp.std.c
Article #2Questions about conversions of pointer-to-qualified types.
From: Ronald F. Guilmette
Date: Tue, 27 Oct 1992 07:33
Date: Tue, 27 Oct 1992 07:33
57 lines
2080 bytes
2080 bytes
I'm having a hard time understanding just what the standard says (let
alone what it means) when it comes to implicit conversions of one
pointer type to another.
Basically, I'd like to obtain a summary of *all* of the rules... especially
the ones relating to type qualifiers.
Here is an example of what I mean...
void *vp;
char const *ccp;
vp = ccp;
I'm fairly sure that this assignment is legal (even though I think it
shouldn't have been permitted by x3j11).
Now, what about this:
const void *cvp;
char *cp;
cp = cvp;
Is *that* assignment permitted?
Now section 3.2.2.3 seems pretty clear, but I know that there are other
bits of relevant stuff hiding elsewhere in the standard (but I'm not
sure where anymore). I'm pretty sure that the phrase "a qualified or
unqualified version of void" is lurking in there somewhere... and it
may relate to this "conversions" issue... but where is it that I saw
that?
(Note that "void" comes up a lot in the standard in different contexts.
For example, 3.3.4 seems to say that:
int i;
... (const void) i;
... is illegal!
// Ron ("Loose Cannon") Guilmette
// uucp: ...uunet!lupine!segfault!rfg
// New new motto: Quality control is a state of mind.
// misc.forsale.computers ad, circa 2007:
// Used Cray wrist watch for sale; 25 bucks or best offer.
--
// Ron ("Loose Cannon") Guilmette
// uucp: ...uunet!lupine!segfault!rfg
// New new motto: Quality control is a state of mind.
// misc.forsale.computers ad, circa 2007:
// Used Cray wrist watch for sale; 25 bucks or best offer.
Technical Details
Message-ID:
<1992Oct27.073329.6679@netcom.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!wupost!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!umn.edu!csus.edu!netcom.com!rfgShow Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!wupost!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!umn.edu!csus.edu!netcom.com!rfg From: rfg@netcom.com (Ronald F. Guilmette) Subject: Questions about conversions of pointer-to-qualified types. Message-ID: <1992Oct27.073329.6679@netcom.com> Organization: Netcom - Online Communication Services (408 241-9760 guest) Date: Tue, 27 Oct 1992 07:33:29 GMT Lines: 57