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

  1. Xref: sparky comp.std.c:2996 comp.lang.c:16230
  2. Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!usenet.ins.cwru.edu!agate!doc.ic.ac.uk!uknet!edcastle!dcs.ed.ac.uk!mikef
  3. From: mikef@dcs.ed.ac.uk (Mike Fourman)
  4. Newsgroups: comp.std.c,comp.lang.c
  5. Subject: Array size checks
  6. Message-ID: <BxGnB6.5nt@dcs.ed.ac.uk>
  7. Date: 9 Nov 92 17:59:29 GMT
  8. Sender: cnews@dcs.ed.ac.uk (UseNet News Admin)
  9. Organization: Department of Computer Science, University of Edinburgh
  10. Lines: 31
  11.  
  12. 3.3.2.2 Function Calls
  13. "Each argument shall have a type such that its value may be assigned to an 
  14. object with the unqualified version of the type of its corresponding 
  15. parameter."
  16.  
  17. 3.3.16.1 Simple Assignment
  18. "both operands are pointers to qualified or unqualified versions of
  19. compatible types, ..."
  20.  
  21. [or other options]
  22.  
  23. Does this mean that if I have the following
  24.  
  25. int big_array[10] ;
  26. void function_using_small_array( int argument_array[5] ) ;
  27. void function_using_ptr_to_small_array( int (*ptr_to_argument_array)[5] ) ;
  28.  
  29. then the following behaviour (cf gcc) is conforming??
  30.  
  31. function_using_small_array( big_array ) ; /* no warning -- O dear! */
  32.  
  33. function_using_ptr_to_small_array( &big_array ) ; /* warning -- OK */
  34.  
  35. Do any compilers warn about the first usage? Shouldn't they?
  36.  
  37. -- 
  38. Prof. Michael P. Fourman                     email        mikef@dcs.ed.ac.uk
  39. Dept. of Computer Science                    'PHONE (+44) (0)31-650 5198 (sec)
  40. JCMB, King's Buildings, Mayfield Road,              (+44) (0)31-650 5197
  41. Edinburgh EH9 3JZ, Scotland, UK                 FAX (+44) (0)31 667 7209
  42. -------------------------------------------------------------------------------
  43.