views:

729

answers:

4

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?

+7  A: 

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.

Paul Tomblin
+12  A: 

I had no idea so i googled to find something about this... Here's 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)

But it was never standardized, so some compilers used it, but in their very personal way. (from http://bytes.com/forum/thread214853.html)

It was later declared obsolete, I guess.

Benoît
+6  A: 

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.

Robert Gamble
+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
That would truly cement C's position as "all the power and speed of assembly language, with all the readability of assembly language".
paxdiablo
A: 

http://fixunix.com/unix/523390-entry-point.html :

The entry point is the start of the code space (unless otherwise specified with a linker option), which for executables is almost always crt0. The c compiler system will have crt0.o in its standard link area, very dependant on the system for where this is. crt0 is the one that initializes the standard C lib, and eventually calls main(). There may be additional stages depending on the language (ie. crt1, crt2, etc).

All linkers have many options to specify these things, and most are pretty different than one another.

There are additional init link areas for static constructors and destructors in the executable file, usually specified with #pragmas to the compiler to be gathered together in the link stage.

shared libraries don't have an entry point on unix systems. They have static constructors/destructures, again in seperate areas in the object file to be gathered together properly in the link stage.

The C compiler system is the one area where different unix systems are vastly different than one another. Even though many use GCC now-a-days, even then, they get installed and used very differently (ie. Darwin vs. Linux x86 systems). And the bigger vendors have their own compiler suites (ie. Sun and HP) that are all different than GCC as well.

You'll really have to study the specific system you are interested in for their documentation on the C compiler system for this sort of info.

http://en.wikipedia.org/wiki/Entry_point

plan9assembler
The question asked about C having an "entry" keyword.
Evan Teran