Path: utzoo!utgpu!watserv1!watmath!att!rutgers!uwm.edu!rpi!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!uflorida!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Nasty bug Message-ID: <26328@mimsy.umd.edu> Date: 1 Sep 90 20:43:59 GMT References: <0093BF08.7F3834E0@rigel.efd.lth.se> <7330028@hpcllca.HP.COM> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 28 In article <7330028@hpcllca.HP.COM> walter@hpcllca.HP.COM (Walter Murray) writes: >You got bit by what is called type rewriting [in which a C compiler changes the type of a formal parameter declaration to match the type of any actual parameter passed by any caller, i.e., the compiler applies type-widening rules]. >Type rewriting is not permitted for a compiler that conforms to the >ANSI standard. ... ... except in the case of formal array parameters, where it is required: f(x) int x[]; { ... /* sizeof(x) == sizeof(int *) */ is the same as f(x) int *x; { ... /* sizeof(x) == sizeof(int *) */ and in fact the compiler is Officially Obliged to forget% that x was declared with empty square brackets rather than an asterisk. The situation is unchanged when prototype definitions are used. ----- % Well, modulo things not covered by the standard, such as program listings, error messages, and warnings. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris