home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / c / 16489 < prev    next >
Encoding:
Internet Message Format  |  1992-11-14  |  1.3 KB

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!rutgers!news.columbia.edu!psinntp!psinntp!dg-rtp!sheol!throopw
  2. From: throopw@sheol.UUCP (Wayne Throop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: & of array - what does ANSI specify for resulting value?
  5. Summary: what you mean "value", kemosabe?
  6. Message-ID: <721626996@sheol.UUCP>
  7. Date: 13 Nov 92 01:08:50 GMT
  8. References: <1992Nov12.174305.1901@ils.nwu.edu>
  9. Lines: 21
  10.  
  11. : From: engber@ils.nwu.edu (Mike Engber)
  12. : Message-ID: <1992Nov12.174305.1901@ils.nwu.edu>
  13. :              int foo[3];
  14. : I know ANSI specifies the type of &foo will be an int**, how about
  15. : the value? Is it unspecified - or - &foo[0].
  16.  
  17. Hmmmm.  As Will Rogers said, "It ain't what you don't know
  18. that'll git ya... it's all them things you know that ain't so!".
  19.  
  20. The type of &foo is NOT (I repeat NOT NOT NOT) (int**).
  21. It is (int (*)[10]).  (In K&R, it used to be of type (int*).)
  22. You can tell the difference by (eg)
  23.  
  24.        printf( "%d %d\n", sizeof *&foo, sizeof *(int**)&foo );
  25.  
  26. As to the value... well, it's probably a good bet that 
  27. ((void*)&foo) and ((void*)&foo[0]) will compare equal.  Though
  28. I doubt that the standard claims that it must do so (what with
  29. its rigidly defined areas of uncertainty and doubt, and all).
  30. --
  31. Wayne Throop  ...!mcnc!dg-rtp!sheol!throopw
  32.