Path: utzoo!utgpu!attcan!uunet!husc6!rutgers!att!poseidon!psrc From: psrc@poseidon.ATT.COM (Paul S. R. Chisholm) Newsgroups: comp.lang.c Subject: Re: Undeclared function arguments Summary: assumed to be int Message-ID: <538@poseidon.ATT.COM> Date: 17 Oct 88 16:51:07 GMT References: <13168@dhw68k.cts.com> Organization: AT&T Bell Laboratories Lines: 30 <"He seemed like such a nice man . . . and then he turned out to be a writer!"> In article <13168@dhw68k.cts.com>, Rick 'Transputer' Stein@dhw68k.cts.com (Rick 'Transputer' Stein) asks why the following compiles cleanly: yyback(p,m) int *p; { if (p==0)return(0); while(*p) { if ( *p++ == 0 )return(1); } return(0); } > I've compiled this fragment along with the body of lex.yy.c on many > machines and compilers (SGI/4D, HP9000, SUN/4, Inmos transputers with > 3L,MSC 4.0, etc) and no errors have been generated. Are undeclared > function arguments auto casted to pointers? >Rick 'Transputer' Stein, {felix, zardoz}!dhw68k!stein According to K&R 1st ed. (p. 205), "Any [parameter-list] identifiers whose type is not given are taken to be int." p is declared and used as a pointer. m is implicitly declared an int, and not used at all! (But lint should have complained about m as an unused argument.) Paul S. R. Chisholm, psrc@poseidon.att.com (formerly psc@lznv.att.com) AT&T Bell Laboratories, att!poseidon!psrc, AT&T Mail !psrchisholm I'm not speaking for the company, I'm just speaking my mind.