Whatever happened to the 'entry' keyword?

后端 未结 4 1121
青春惊慌失措
青春惊慌失措 2020-12-16 09:18

While cruising through my white book the other day, I noticed in the list of C keywords. entry is one of the keywords on that list.

It is reserved f

相关标签:
4条回答
  • 2020-12-16 09:59

    In FORTRAN, "ENTRY" could declare a second entry point into a subroutine. It was a structured programming nightware, and fortunately C decided not to adopt it.

    0 讨论(0)
  • 2020-12-16 10:01

    I had no idea, so I googled to find something about this. This is what I found.

    First, it was included as a reserved keyword.

    Q: What was the entry keyword mentioned in K&R1?
    A: It was reserved to allow functions with multiple, differently-named entry points, but it has been withdrawn.

    (From http://archives.devshed.com/forums/c-c-134/c-programming-faqs-371017.html.)

    It was never standardized; some compilers used it, in a very personal way.

    It was later declared obsolete, I guess.

    0 讨论(0)
  • 2020-12-16 10:03

    To complement the accepted answer 'entry' is mentioned in K&R1:

    2.3 Keywords

    The following identifiers are reserved for use as keywords, and may not be used otherwise

    int extern else

    char register for

    float typedef do

    double static while

    struct goto switch

    union return case

    long sizeof default

    short break entry

    unsigned continue

    auto if

    and here:

    The entry keyword is not currently implemented by any compiler but is reserved for future use. Some implementations also reserve the words 'fortran' and 'asm'.

    Then in the Rationale for the ANSI C language (C89) it is mentioned here:

    3.1.1 Keyword

    [...]

    The keywords 'entry' 'fortran', and 'asm' have not been included since they were either never used, or are not portable. Uses of 'fortran' and 'asm' as keywords are not as common extensions.

    0 讨论(0)
  • 2020-12-16 10:14

    The entry keyword came from PL/I and allowed multiple entry points into a function. The keyword was implemented by some compilers but was never standardized.

    0 讨论(0)
提交回复
热议问题