Re: Pointers to "why C behaves like that ?"

"David Thompson" <david.thompson1@worldnet.att.net>
26 Nov 2002 21:50:07 -0500

          From comp.compilers

Related articles
[32 earlier articles]
Re: Pointers to "why C behaves like that ?" cgweav@aol.com (Clayton Weaver) (2002-11-24)
Re: Pointers to "why C behaves like that ?" joachim_d@gmx.de (Joachim Durchholz) (2002-11-24)
Re: Pointers to "why C behaves like that ?" joachim_d@gmx.de (Joachim Durchholz) (2002-11-24)
Re: Pointers to "why C behaves like that ?" jacob@jacob.remcomp.fr (jacob navia) (2002-11-26)
Re: Pointers to "why C behaves like that ?" jacob@jacob.remcomp.fr (jacob navia) (2002-11-26)
Re: Pointers to "why C behaves like that ?" jacob@jacob.remcomp.fr (jacob navia) (2002-11-26)
Re: Pointers to "why C behaves like that ?" david.thompson1@worldnet.att.net (David Thompson) (2002-11-26)
Re: Pointers to "why C behaves like that ?" ajo@andrew.cmu.edu (Arthur J. O'Dwyer) (2002-11-26)
Re: Pointers to "why C behaves like that ?" thp@cs.ucr.edu (2002-11-26)
Re: Pointers to "why C behaves like that ?" thp@cs.ucr.edu (2002-11-26)
Re: Pointers to "why C behaves like that ?" Nicola.Musatti@ObjectWay.it (Nicola Musatti) (2002-11-26)
Re: Pointers to "why C behaves like that ?" nmm1@cus.cam.ac.uk (Nick Maclaren) (2002-11-26)
Re: Pointers to "why C behaves like that ?" peter_flass@yahoo.com (Peter Flass) (2002-11-26)
[28 later articles]
| List of all articles for this month |

From: "David Thompson" <david.thompson1@worldnet.att.net>
Newsgroups: comp.compilers
Date: 26 Nov 2002 21:50:07 -0500
Organization: AT&T Worldnet
References: 02-11-059 02-11-071 02-11-083 02-11-091
Keywords: types, history, design
Posted-Date: 26 Nov 2002 21:50:07 EST

Gayev.D.G. @mail.rsl.ru <dgàev@mail.ru> wrote :
....
> Of cause, the historical reasons also must be taken into
> account. Since the first "traditional" language (it was Algol-58,
> IMHO), the language designers decided what the forward declarations of
> variables is a good thing to have. IMHO, they are right :-) ...
> [Fortran and, debatably, Cobol preceded Algol-58. In Fortran, declarations
> are optional, in Cobol they're required. Fortran 77 added IMPLICIT NONE to
> let you turn off the automatic declarations. -John]


Although in Fortran you can omit the declaration only if or to the
extent the implicit one -- scalar or function with type determined by
the first letter of the identifier, or a called subroutine or
intrinsic, not array or any of the new F90+ features like ALLOCATABLE
-- is correct. Type of a variable is not implied, nor altered, by the
value(s) assigned, and a routine name has a single type and binding
except for intrinsics and in F90+ (explicitly) declared generics.


And for completeness as to the original question, in COBOL always and
Fortran when present the declarations precede code. Except that in
COBOL85 and F90+ entire nested subprograms (declarations AND code) may
follow the code of an outer subprogram. In PL/I also, as already
noted, declarations can be omitted if the default is correct, but if
present can occur anywhere even after reference; I don't recall seeing
any good use for this except nested PROCs.
--
- David.Thompson 1 now at worldnet.att.net


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.