[comp.lang.c] reserved word 'entry'

jgh@root.co.uk (Jeremy G Harris) (08/17/87)

Does anybody know what the K&R-listed reserved word 'entry' was for?
Anybody have a compiler which uses it?
When I was bitten by one which rejected it, I was confused and resorted
to looking it up :-)  Sure enough, there it was....

The only application which came to mind was as a label for a non-local
goto.   I nearly threw up.

What does ANSI say?


Reference: K&R p180  Keywords


Jeremy					(I don't speak for my company)
-- 
Jeremy Harris			jgh@root.co.uk

gwyn@brl-smoke.ARPA (Doug Gwyn ) (08/20/87)

In article <402@root44.co.uk> jgh@root.co.uk (Jeremy G Harris) writes:
>Does anybody know what the K&R-listed reserved word 'entry' was for?

It was originally intended for an alternate function entry point,
as in FORTRAN.  This is sometimes used, for example, in math
library implementations of the SIN() and COS() functions, to
avoid having to add the overhead of an extra level of function
call (COS(X) can be implemented as SIN(X+PI/2)).

Very few, if any, C compilers implemented "entry" (other than
reserving the keyword), and X3J11 decided to get r ( ( nadeY

flaps@utcsri.UUCP (08/20/87)

In article <402@root44.co.uk> jgh@root.co.uk (Jeremy G Harris) writes:
>Does anybody know what the K&R-listed reserved word 'entry' was for?
>Anybody have a compiler which uses it?

It wasn't for anything, it was one of these 'reserved for future use'
things.  I don't know of any environment which uses it other than to print
"syntax error".

I always assumed that it was modeled on the fortran ENTRY keyword, which
allows multiple entry points to a function.  It's sort of like using
fall-throughs in case statements.

For an example: the slightly misleading structure

	int fullcalculation()
	{
	    ...
	    partialcalculation();
	}

	int partialcalculation()
	{
	    ...
	}

would be replaced by something like:

	int fullcalculation()
	{
	    ...
	
	entry partialcalculation;
	    ...
	}


It's not entirely clear what the advantage is.  Of course, you don't
have to say the formal parameters twice, and they don't have to be pushed
on the stack twice, but this could be optimized out as a special case kind
of tail recursion anyway by either a very smart compiler, or a compiler
implemented by someone who thinks that the 'entry' keyword would make a
big difference.

ajr

jay@splut.UUCP (Jay Maynard) (08/21/87)

In article <402@root44.co.uk>, jgh@root.co.uk (Jeremy G Harris) writes:
> Does anybody know what the K&R-listed reserved word 'entry' was for?

Actually, when I saw it, ti looked like a means for an alternate entry point
into a routine. (Yes, I know this violates block structuring...but it's
[somewhat widely] used on 370-architecture mainframes.)

> Anybody have a compiler which uses it?

Not C...but my PL/I does nicely! :-)

> The only application which came to mind was as a label for a non-local
> goto.   I nearly threw up.

Is this what you had in mind?

-- 
Jay Maynard, K5ZC...>splut!< | uucp: hoptoad!academ!uhnix1!nuchat!splut!jay
"Don't ask ME about Unix...  | (or sun!housun!nuchat)       CI$: 71036,1603
I speak SNA!"                | internet: beats me         GEnie: JAYMAYNARD
The opinions herein are shared by neither of my cats, much less anyone else.