Nasty bug
Chris Torek
chris at mimsy.umd.edu
Sun Sep 2 06:43:59 AEST 1990
In article <7330028 at hpcllca.HP.COM> walter at 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 at cs.umd.edu Path: uunet!mimsy!chris
More information about the Comp.lang.c
mailing list