home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20072 < prev    next >
Encoding:
Internet Message Format  |  1993-01-22  |  1.3 KB

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