need help with a delcaration
karl at haddock
karl at haddock
Wed Sep 10 04:00:00 AEST 1986
BJORNDAS%CLARGRA at WISCVM.WISC.EDU (Sterling Bjorndahl) writes:
>foo(ch)
>char ch; /* Or should this be "int ch;" because it gets promoted? */
>{}
>
>On my micro it MUST be declared an int; I think this is screwy...
This relates to what I just said in another topic. Discounting function
prototyping (ANSI proposed), actual arguments of type char, short, float,
and array are converted; therefore one should never declare formal arguments
of these types. However, you are right -- the C language is supposed to
silently fix it for you by interpreting your "char" declaration as an "int".
Your compiler is broken.
Karl W. Z. Heuer (ima!haddock!karl; karl at haddock.isc.com), The Walking Lint
More information about the Comp.lang.c
mailing list