Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Future of C Date: Thu, 15 Mar 2018 12:54:32 -0700 Organization: None to speak of Lines: 78 Message-ID: References: <0231327b-9e28-46e4-9178-46c881a8dd91@googlegroups.com> <8e201938-ada4-42d9-8ae6-13b1047306e2@googlegroups.com> <0iXpC.1451$kF1.89@fx41.am4> <40d27639-bea8-460a-add2-f5ad2f26cbdc@googlegroups.com> <5e80c990-fe53-4d7e-8a81-bc411cc21d76@googlegroups.com> <2ac9ccf7-5b25-4822-8dbd-5b749bed2c07@googlegroups.com> <08f373de-3438-464d-a52b-77af9564b4bf@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="4062d3804107f3b0a8439aa53526a52c"; logging-data="14905"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Ps7k/XJojPO5rARa/ufNJ" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:/Dn257hKsE7H95Pb2F4HMnhHc5s= sha1:Rio9pm4aopHPe91C0Ka/OfdnnAI= Xref: csiph.com comp.lang.c:127889 supercat@casperkitty.com writes: > On Thursday, March 15, 2018 at 12:25:12 PM UTC-5, Keith Thompson wrote: >> supercat@casperkitty.com writes: >> > It may nominally be a requirement for conformance, but so's the ability >> > to support at least 9 full decimal digits of floating-point precision. >> >> Support for recursion is mandatory. Anything that doesn't support >> recursion is not a conforming C implementation. (Not even for your >> beloved C74.) > > Does the Standard mandate any circumstances where a recursive function call > must succeed without stack overflow? If not, in what sense is support for > recursion really mandatory? You're right, nothing in C is really mandatory (other than the ability to translate and execute the infamous One Program), so why bother discussing anything about such a useless language? > C74 was designed for certain kinds of machines. On such machines, the > value of supporting recursion will exceed the cost. Did you omit a word? "Recursive calls to any function are permissible." -- cman74.pdf 7.1.6. > A language which is > similar to C74 but lacks recursion may be useful for many purposes on > machines for which the cost of supporting recursion would exceed the > value. Sure, not all implementations have to be conforming. If a non-conforming implementation is useful, that's great. No 64-bit integers, no recursion, no floating-point, whatever. > Allowing the abilities of a C implementation to vary according to the > platform upon which it is running will allow code that needs features that > only exist on higher-end platforms to benefit from those features, while > still allowing code that doesn't need those features to run on more > platforms than it could if those features were mandatory. > > As noted, an implementation of a dialect of C without recursion would > not be a full-featured C implementation, but implementations of such > dialects can be useful for many purposes, and I see no real benefit to > having the Standard ignore them. Such an implementation can be accompanied by a document that says "This implementation conforms the [year] edition of the C standard *except* that recursive function calls have undefined behavior, and are diagnosed in most cases." (I'm not sure it would be possible to diagnose recursion in all cases, given function pointers.) There's no need for the standard to be changed to allow that. >> > I think it was abandoned around 1995, but I mentioned it to show that >> > some actual real-world platforms would be capable of supporting recursion >> > without being able to efficiently support VLAs. >> >> From your description, it sounds like the support for recursion isn't >> particularly efficient. To support recursion, you need to implement >> something that acts like a stack; if there's no hardware support for a >> stack, that's going to be awkward. Likewise for VLAs. > > That compiler supports recursion in the most efficient way possible on > that platform. So a conforming C99 compiler can support VLAs in the most efficient way possible on that platform. Or it can *not* support VLAs and not claim conformance. It can state that it conforms to C99 except that VLAs are not permitted. Again, I see no need for the standard to be changed to accomodate such implementations. Or it can claim conformance to C11 and predefine __STDC_NO_VLA__. [...] -- 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"