Sujet : Re: transpiling to low level C
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 17. Dec 2024, 21:13:15
Autres entêtes
Organisation : None to speak of
Message-ID : <87ldwe6pb8.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : Gnus/5.13 (Gnus v5.13)
bart <
bc@freeuk.com> writes:
On 17/12/2024 01:19, Keith Thompson wrote:
bart <bc@freeuk.com> writes:
[SNIP]
In that case I've no idea what you were trying to say.
>
When somebody says that 'goto' can emulate any control structure, then
clearly some of them need to be conditional; that is implied.
>
Your reply suggested they you can do away with 'goto', and use
recursive functions, in a scenario where no other control structures
need exist.
>
OK, if this is not for an IL, then it's not a language I would care
for either. Why tie one hand behind your back for no good reason?
I read Janis's post. I saw a suggestion that certain constructs are
*theoretically* unnecessary. I saw no suggestion of any advocacy for
such an approach.
"""
A 'goto' may be used but it isn't strictly *necessary*. What *is*
necessary, though, that is an 'if' (some conditional branch), and
either 'goto' or recursive functions.
"""
>
This doesn't actually make much sense. So 'goto' is necessary, but
'goto' *is*?
I presume you didn't write what you intended to write. Responding to
what I *think* you meant :
Either
"if" and "goto"
or
"if" and recursive functions
are theoretically sufficient to express certain kinds of algorithms
(I'm handwaving a bit). Which implies that "goto" is not strictly
necessary. It also implies that recursive functions are not strictly
necessary if you have "goto".
Since this is comp.lang.c, not comp.theory (or what comp.theory was
intended to be), I'm not going to go into the details, nor am I going to
take the time to express the concept in mathematically rigorous terms.
If you try to extract any meaning, it is that any control flow can be
expressed either with 'goto' or with 'recursive functions'.
Yes, either of those plus "if". It appears you understand the point.
This is what I picked up on. Who on earth would eschew 'goto' and use
such a disproportionately more complex and inefficient method like
recursive functions?
Perhaps it wasn't clear initially, but it should be by now,
that Janis was talking about what's theoretically sufficient to
express general algorithms. You seized on the silly idea that
Janis was *advocating* the use of one of the two minimal methods in
an intermediate language for a compiler. The idea Janis brought
up (briefly, in passing) is about theoretical computer science,
not practical software engineering. (Janis, please correct me if
I'm mistaken.)
Repeatedly asking why anyone would do such a thing misses the point.
[...]
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */