home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / std / c / 3388 next >
Encoding:
Text File  |  1993-01-21  |  1.6 KB  |  35 lines

  1. Newsgroups: comp.std.c
  2. Path: sparky!uunet!haven.umd.edu!decuac!pa.dec.com!engage.pko.dec.com!e2big.mko.dec.com!nntpd.lkg.dec.com!jit533.jit.dec.com!diamond
  3. From: diamond@jit533.jit.dec.com (Norman Diamond)
  4. Subject: Re: Null pointer constant compatible with pointer to funtion ?
  5. Message-ID: <1993Jan21.061433.29672@nntpd.lkg.dec.com>
  6. Keywords: pointer
  7. Sender: usenet@nntpd.lkg.dec.com (USENET News System)
  8. Reply-To: diamond@jit.dec.com (Norman Diamond)
  9. Organization: Digital Equipment Corporation Japan , Tokyo
  10. References: <1993Jan21.001622.13452@xilinx.com>
  11. Date: Thu, 21 Jan 1993 06:14:33 GMT
  12. Lines: 21
  13.  
  14. In article <1993Jan21.001622.13452@xilinx.com> lou@xilinx.com (Lou Sanchez-Chopitea) writes:
  15. >    Is a null pointer constant (3.2.2.3) (and therefore NULL (4.1.5)) 
  16. >assignment compatible with a pointer to function ?
  17. >standard conforming ?
  18. >        #include <stddef.h>
  19. >            void (*g)( void);
  20. >            g = NULL;
  21.  
  22. Yes.  Null pointer constants specifically have this magic property.
  23. 3.2.2.3, 3.3.16.1, 3.3.9, and 3.3.15 all define capabilities for
  24. null pointer constants in relation to all kinds of pointers.
  25.  
  26. In other contexts, a null pointer constant reverts to being a simple
  27. integer constant which happens to be 0, or a constant (void *) pointer
  28. to objects which happens to be a null pointer (depending on which kind of
  29. expression you coded, or which way the implementation defines NULL).
  30. Those would be different, not compatible with pointers to functions.
  31. --
  32. Norman Diamond                diamond@jit.dec.com
  33. If this were the company's opinion, I wouldn't be allowed to post it.
  34. Pardon me?  Or do I have to commit a crime first?
  35.