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: Problem with the function that should display new letter Date: Sat, 31 Oct 2015 12:40:03 -0700 Organization: None to speak of Lines: 55 Message-ID: References: <35a13b2e-2412-40ea-89e4-1985879e542c@googlegroups.com> <34ba9d6a-42ad-4d2d-9405-5c46b98369b8@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="7238"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19w0LRxImyiW5HPCyP00n+N" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:KkiIpDOHfNwnY89EGj5ZwKbNNLg= sha1:24n0l39j26X0eKgqx3ZKMseMFfQ= Xref: csiph.com comp.lang.c:74478 Tim Rentsch writes: > Keith Thompson writes: >> Tim Rentsch writes: > [snip] > >>> Furthermore, whether or not we consider a definition of main() >>> that does not have a prototype to be equivalent to a definition >>> of main() that does have a prototype, there is no question that >>> two declarations of main() (neither attached to any definition) >>> are /not/ equivalent if one has a prototype and the other does >>> not. Do you agree? >> >> I agree that they're not equivalent. I don't agree that there's >> no question; others have given different opinions on the matter. >> (We needn't get into that detail.) > > How does anyone think that a declaration of main() without a > prototype and a declaration of main() with a prototype are > equivalent (to be clear, considered just as declarations, with no > associated definitions involved)? [snip] I have again foolishly glossed over the distinction between declarations and definitions. There has been a great deal of discussion about *definitions* of main. There has been very little about *declarations* of main. Because declaring main other than as part of its definition is uncommon and not particularly useful, I tend to ignore it. The opinion has been stated that *definitions* of main with and without a prototype are "equivalent". Concretely, it was argued that these: int main() { } int main(void) { } are equivalent programs. My counterargument (with which I think you'd agree) was that these: int main() { if (0) return main(42); } int main(void) { if (0) return main(42); } are not equivalent (the first is valid, the second violates a constraint). Sorry for the confusion. [...] -- 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"