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: Wed, 30 Nov 2016 17:22:38 -0800 Organization: None to speak of Lines: 37 Message-ID: References: <0e1db67d-0ab8-4971-a319-8aa66a40b873@googlegroups.com> <436aadfe-20e5-4349-bdf4-9bac145b0d7e@googlegroups.com> <87oa0zi280.fsf@bsb.me.uk> <871sxvhw4i.fsf@bsb.me.uk> <87wpfl251i.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="e9e90b81bc42428c034e25748a0d26e9"; logging-data="9001"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/N7ZbTKpkFz/+LM8Iag8yY" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:KsyHP0UNOQ0nZOQNAbrIx5oa51k= sha1:KqMKAfnlc0AqWH1+QA3Cor7qt6U= Xref: csiph.com comp.lang.c:97802 BartC writes: > On 30/11/2016 23:49, Keith Thompson wrote: >> BartC writes: >> [...] >>> Here's an example. someType1/2 are both opaque types as far as main() is >>> concerned. But the behaviour is different depending on whether they are >>> defined as a two-element struct, or two-element array: >> >> Then they're not opaque, are they? > > main() doesn't know whether each is struct or array. (Except in the > printf calls for this test, but that can also be provided as > print_someType1 and so on.) Sure it does. The declarations of both types are visible from main. > If such a type provided by a library changed implementation between > array and struct, then code will need recompiling, but may also behave > differently. Yes, if you change a type, the code will behave differently. > This is a consequence of array types hitting that 'hole' in the type > system and needing to change from pass-by-value, to > pass-by-value-of-pointer-to-first-element-of-array. Or in reverse if > moving away from array types. More accurately, arrays cannot be passed as arguments (though it's easy to achieve the effect of passing them by reference). [...] -- 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"