Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: absence of max Date: Fri, 09 Dec 2016 15:45:56 -0800 Organization: None to speak of Lines: 34 Message-ID: References: <0e1db67d-0ab8-4971-a319-8aa66a40b873@googlegroups.com> <2bba48cd-e2c6-44f1-bce9-eff26acbba50@googlegroups.com> <37a4c69f-07eb-4e03-b548-7348629e6b3c@googlegroups.com> <71c8962e-b06e-44a5-8bda-a79d8cda48e5@googlegroups.com> <71b11aaa-478e-4b1a-9411-e27093a58ab8@googlegroups.com> <87mvgagff0.fsf@bsb.me.uk> <874m2gh2u7.fsf@bsb.me.uk> <9c45c97c-5a79-4671-90e5-757d5fb40347@googlegroups.com> <87fuly9hz5.fsf@bsb.me.uk> <87d1h069cg.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="d3e5cee4cb06db8dd070f0b5a238435d"; logging-data="9985"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+CD8a1RAIHxY9JEHjOvwX9" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:E2G8c3jkJKbAYR3NaU9XIjp9law= sha1:31nTQKvEDZeVTxg4En78SiNFTQg= Xref: csiph.com comp.lang.c:98623 Ben Bacarisse writes: [...] > BTW (and this is for anyone else -- Jerry is in full-on fingers in the > ears la, la, la mode now) the fragility I was originally talking about > can be illustrated like this: > > f(a) > double a > { ... } > > g() { f(42); } /* A Stuckle compiler converts this to 42.0 */ > > Refactor it by putting f in a separate translation unit: > > f(); /* declaration of f, possibly #included */ > > g() { f(42); } /* This now goes wrong */ > > The code was broken before, but you only get to see (and test for) the > error when f is moved. K&R's rules ensure that replacing a function > definition by just a declaration will not alter the semantics of > subsequent function calls. Another problem: if, contrary to reality, pre-ANSI C were *supposed* to work this way (i.e., converting arguments to the parameter type only when the definition is visible), it would have left a gaping hole in the language: it would not be possible for two mutually recursive functions to take advantage 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"