<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Wed, 23 Sep 2009 00:54:16 +0100
From   : philpem@... (Philip Pemberton)
Subject: Beeb, this was your grandma!

afra@... wrote:
> Well in C you also have to define something before you use it, which  
> admittedly you can do with function prototypes now, but could you back  
> then ? More modern Pascal compilers also have a facility like this also.

I'd expect so. Otherwise, what's the point of having header files?

Gcc 2.95 certainly did it, and I seem to recall having some level of 
function prototyping on early (~v1.5) versions of Turbo C++ / Borland 
C++ too.

I can't see anything about it in my pre-ANSI copy of K&R, but I'm 
willing to bet it was available as a feature (there is plenty of mention 
of headers / linking procedures).

But there is one Pascal feature I used to miss -- nested functions:

function fred(x : Integer; y : Integer) : Integer;
   function jim(y : Integer) : Integer;
   begin
     return y*5;
   end;
begin
   return (x*2)+jim(y);
end;

Nothing outside of "fred" can see "jim" -- effectively this is like a 
static function, but restricted to a single function rather than a 
single module (or Unit in Pascal parlance). Interestingly Pascal seems 
to be the only language that supports this...

-- 
Phil.
philpem@...          
http://www.philpem.me.uk/
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>