Article View: comp.std.c
Article #4387p != (void*)p?
From: Jim Hill
Date: Tue, 21 Nov 1995 02:27
Date: Tue, 21 Nov 1995 02:27
32 lines
1853 bytes
1853 bytes
[summary:] (ANSI numbers) 3.2.2.3 says the result of converting the void pointer back to its original type shall compare equal to the original value. 3.3.9 says the relevant conversion is to a void pointer, not to the (putatively) original type. As I read it, there's no guarantee that `p == (void*)p` - e.g. the old DEC10 could implement anythingbutchar*-to-void* as either MOVE or HRR. In article <48q3mn$86c@solutions.solon.com>, tanmoy@qcd.Lanl.GOV (Tanmoy Bhattacharya) wrote: >I agree that a standard _should_ stand up to a very >rigorous scrutiny: I am claiming that it _does not_; and that this is not the >only case where it fails to meet this expectation. > >I would have taken a different tone if this were posted to comp.std.c Ok, I can't resist that teaser; here it is. I can't find any language in the standard that forbids p != (void*)p. What's more, given that comparing pointers that may be in different "object"s is unspecified at best, I can't find any hard reason to believe it *should* forbid that - in any situation where a void* cast was necessary, comparison is useless anyway. Which leaves me wondering what my scrutiny missed. Jim -- Jim Hill Contents public domain and worth $.02 more than you paid. jthill@netcom.com PGPrint: 6B 85 76 D1 EF BA 2C 78 12 25 8A 5A BF F3 37 7E
Technical Details
Message-ID:
<jthill-2011951827090001@jthill.slip.netcom.com>Path:
arc1-ca.pugleaf.net!jthill.slip.netcom.com!userReferences:
<48cobl$htc@solutions.solon.com> <48egog$4he@solutions.solon.com> <48inrk$ie0@solutions.solon.com> <48l6p6$p70@solutions.solon.com> <48q3mn$86c@solutions.solon.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!jthill.slip.netcom.com!user From: jthill@netcom.com (Jim Hill) Subject: p != (void*)p? Message-ID: <jthill-2011951827090001@jthill.slip.netcom.com> Sender: jthill@netcom4.netcom.com Organization: biological <-- hey! a one-word oxymoron! References: <48cobl$htc@solutions.solon.com> <48egog$4he@solutions.solon.com> <48inrk$ie0@solutions.solon.com> <48l6p6$p70@solutions.solon.com> <48q3mn$86c@solutions.solon.com> Date: Tue, 21 Nov 1995 02:27:09 GMT