[comp.lang.misc] Order of declarations

sommar@enea.se (Erland Sommarskog) (01/12/91)

Also sprach Dr A. N. Walker (anw@maths.nott.ac.uk):
>For example, in C, you have a
>good chance of getting a procedure and everything you need to know
>to understand it onto one screen;  in Pascal, this is very frequently
>impossible, both because of the verbosity of Pascal and because of the
>restrictions on order of declaration;

Thankfully many Pascal compilers lift this restriction and
allow you to declare entities in arbitrary order. If I
have a function within another functions I usually write
something like:

  FUNCTION Nisse(A : integer) : integer;
  VAR  Global : char;
     FUNCTION Kalle(B : integer) : char;
     VAR Local : char;
     BEGIN
        ... Global ...
     END;
  VAR Local : char;
  ...

You still can't declare a variable in the beginning of a new
block like in Ada or Simula, though.
-- 
Erland Sommarskog - ENEA Data, Stockholm - sommar@enea.se
"There is only one success -- to be able to spend your life in your own way"
Christopher Morely