Re: FAQ 1.12--auto keyword



mwojcik@xxxxxxxxxxx (Michael Wojcik) wrote:


In article <443a146b.410693812@xxxxxxxxxxxxxx>, rlb@xxxxxxxxxxxxxxxxxxxxxx (Richard Bos) writes:
"Bill Pursell" <bill.pursell@xxxxxxxxx> wrote:

The faq (question 1.12) states that the keyword "auto" is completely
useless.
However, it is necessary to forward declare a nested function (for
gcc...I'm not sure if this is gcc specific or a language issue.)

There is no such thing as a nested function in ISO C.

If gcc allows nested functions, that's its business. However, if it
requires "auto" to forwardly declare them, this is broken. They should
have chosen "static".

That's debatable. I think "auto" is more appropriate, since it
suggests the additional work necessary to provide the called nested
function with a link to the enclosing function's closure (using a
static chain or display or what have you) as part of its environment.

True; but for logistical reasons, gcc should not have used a keyword
that was existant but previously useless. It leads to confusion. Better
to invent a new one.

That, to me, is a more significant feature of nested functions than
their limited scope, which I imagine is what would justify yet
another application of "static".

Yes, but re-using "static" for purposes only tangentially related to
those it had before is Traditional.

Though to be honest I think reusing any of the existing keywords was
a bad idea; if they want to invent a new language, they should invent
a new language.

I agree. But that would not be as kewl as claiming you've written a C
compiler.

Richard
.



Relevant Pages

  • Re: FAQ 1.12--auto keyword
    ... it is necessary to forward declare a nested function (for ... gcc...I'm not sure if this is gcc specific or a language issue.) ... Standard C doesn't allow nested function definitions. ...
    (comp.lang.c)
  • Re: FAQ 1.12--auto keyword
    ... it is necessary to forward declare a nested function (for ... If gcc allows nested functions, ...
    (comp.lang.c)
  • Re: FAQ 1.12--auto keyword
    ... it is necessary to forward declare a nested function (for ... If gcc allows nested functions, ... if they want to invent a new language, ...
    (comp.lang.c)
  • Re: Variable scope mystery
    ... inside nested function even while you are calling it in. ... You'll have to declare it global in the main function first. ...
    (comp.lang.php)