40

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 for future use. Thinking back to my Fortran days, there was a function of some sort that used an entry statement to make a second argument signature, or entry point into a function.

Is this what entry was originally intended to be used for? or something completely different?

What is the story on the entry keyword?

2
  • 8
    @Evil, every time I see your image, it reminds me of a "Thomas the Tank Engine" gone horribly wrong :-). I'm tempted to show it to my 4yo son to see what name it should get from the Thomas stable.
    – paxdiablo
    Commented Jan 19, 2009 at 2:47
  • @paxdiablo, I appreciate your four-year old would now be 19; but what name did they give Tom Gone Wrong? Commented Jan 31 at 16:15

4 Answers 4

33

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.

18

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

2
  • Was it part of the original K&R standard? Could you show an example code?
    – Gábor
    Commented Feb 24, 2020 at 10:03
  • 1
    @Gábor it was marked as a reserved keyword in K&R1, but as far as I know, (almost) nobody implemented it. Commented Feb 24, 2020 at 21:49
12

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.

2
  • 2
    +1 for an interesting history. I can just see the fits the structured programming fans would be having if, in addition to allowing multiple returns, C also allowed multiple calls to different places within a function. It's almost worth doing to see how they'd react :-).
    – paxdiablo
    Commented Jan 19, 2009 at 3:03
  • 6
    That would truly cement C's position as "all the power and speed of assembly language, with all the readability of assembly language".
    – paxdiablo
    Commented Jan 19, 2009 at 3:05
4

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 noted as common extensions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.