Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!purdue!ames!xanth!kremer From: kremer@cs.odu.edu (Lloyd Kremer) Newsgroups: comp.lang.c Subject: Re: Prototyping char parameters in ANSI C Summary: aren't there NEW rules about this? Message-ID: <8661@xanth.cs.odu.edu> Date: 27 Apr 89 15:35:46 GMT References: <3950014@eecs.nwu.edu> Organization: Old Dominion University, Norfolk, Va. Lines: 39 In article <3950014@eecs.nwu.edu> gore@eecs.nwu.edu (Jacob Gore) writes: >Is this valid ANSI C (or dpANS or whatever you want to call it): > > void f(char); > > void f(c) > char c; > { > } > >The version of GNU cc I have complains: > > t.c: In function f: > t.c:5: argument `c' doesn't match function prototype > t.c:5: a formal parameter type that promotes to `int' > t.c:5: can match only `int' in the prototype The responses I have seen all make reference to "old style" automatic widening of the function argument to an int. The fact that the original poster specified ANSI C suggests that he knows about the "old style" rules. In any case I know I do. :-) But I thought that in the new ANSI C (not old-- NEW!) you could effectively circumvent this behavior and request that small types be received by the called function as a true char (or float, or whatever), size and all. There may still be temporary internal promotion due to hardware characteristics such as the inability to push a single byte onto the stack, but this should be transparent to the programmer. So, I shall now ask: How do you tell the compiler that you want this *NEW* behavior? If a full prototype isn't good enough, what is? -- Lloyd Kremer Brooks Financial Systems ...!uunet!xanth!brooks!lloyd Have terminal...will hack!