Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Program to print the longest line Date: Thu, 19 Nov 2015 21:15:43 -0800 Organization: None to speak of Lines: 36 Message-ID: References: <8a605c3e-2e2d-456f-bcf4-f23bf4c40bc2@googlegroups.com> <8I43y.140491$1Z.7985@fx01.iad> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="15071"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+TBvnJv/UegKZ1wl6MGyHW" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:agxryuXL0KRJK68LBDloepPT3aQ= sha1:NS8GMZnRzw2v6o62BLjbkVqWsXI= Xref: csiph.com comp.lang.c:76599 Alla _ writes: > >> > >> > int getline(char line[], int maxline); >> >> FWIW, K&R1 page 26 gives >> getline(s, lim) >> char s[]; >> int lim; >> { >> ... >> >> It looks here like _Alla is trying to rewrite K&R2 code to match >> something the equivalent K&R1 code. >> > > > No ) I was trying to follow the rules I have learned - prototypes > and function definitions should have consistent names of variables; > this is the only reason why (and what) I have dared to changed in this > program. > Keith has explained my mistake, and now I know, but will follow the > "rule" of being consistent; I believe it adds up to readability of any > code, and to beauty of it. I just checked my copy of K&R2. It does indeed use different parameter names in the declaration and in the definition. I have no idea why; I can't think of any good reason for it -- but as I've said it's perfectly legal. (It might have been useful as a way to illustrate that very point, but there's no explicit mention of it.) -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"