home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!crdgw1!rdsunx.crd.ge.com!bart!volpe
- From: volpe@bart.NoSubdomain.NoDomain (Christopher R Volpe)
- Newsgroups: comp.lang.c
- Subject: Re: can a pointer cast to a void* be compared to (void*)0 ?
- Message-ID: <1993Jan22.154422.17672@crd.ge.com>
- Date: 22 Jan 93 15:44:22 GMT
- References: <C0nzI2.CqM@cs.psu.edu> <1993Jan16.015545.26580@thunder.mcrcim.mcgill.edu> <alien.02pi@acheron.amigans.gen.nz>
- Sender: volpe@bart (Christopher R Volpe)
- Reply-To: volpe@ausable.crd.ge.com
- Organization: GE Corporate Research & Development
- Lines: 20
- Nntp-Posting-Host: bart.crd.ge.com
-
- In article <alien.02pi@acheron.amigans.gen.nz>, alien@acheron.amigans.gen.nz (Ross Smith) writes:
- |>
- |> Sorry, you've got it backwards. (The FAQ explains this in all its gory
- |> detail :-)
- |>
- |> A null pointer is required to remain a null pointer when cast to any other
- |> pointer type (except function pointers, which are a special case), and the
- |> integer zero and any null pointer are required to cast to to each other
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Wrong. You cannot cast an int variable (which happens to contain the value
- zero) to a pointer type and expect to get a NULL pointer. Only an
- "integral constant expression having the value zero" can be so cast.
-
- -Chris
-
- --
- ==================
- Chris Volpe
- G.E. Corporate R&D
- volpecr@crd.ge.com
-