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