Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site pur-phy.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!inuxc!pur-ee!CS-Mordred!Pucc-H:pur-phy!cca From: cca@pur-phy.UUCP (Allen) Newsgroups: net.lang.c Subject: Re: Language transitions Message-ID: <1627@pur-phy.UUCP> Date: Fri, 8-Feb-85 10:36:18 EST Article-I.D.: pur-phy.1627 Posted: Fri Feb 8 10:36:18 1985 Date-Received: Mon, 11-Feb-85 06:28:34 EST References: <252@gumby.UUCP> <535@ukma.UUCP> <258@gumby.UUCP> <4475@ucbvax.ARPA> <268@gumby.UUCP> <302@psivax.UUCP> Reply-To: cca@pur-phy.UUCP (Allen) Organization: Purdue Univ. Physics Dept., IN Lines: 36 Summary: > ... With all his talk about > the importance of data hiding and locality, he did not include local > statics. To get a static variable it must be global! This is significant > lack, I use local statics regularly for internal state variables, which > is what they are for. I also do not seem to remember any facility > for type casting or its equivalent, very useful for general purpose > routines and record type. Let's make sure we get the definitions straight here. For a variable to be "static" it must be declared in a module (i.e. not a procedure). Hence it is "global" to the module. It is NOT visible to the outside world unless it is explicitly exported. Declaring a variable in the implementation part of a module is equivalent to declaring it to be a static variable in a C file. If you want even more restriction on where it's visible, you can tuck it away in a local module. Type casting most definitely IS included. Any variable may be cast to another type OF THE SAME SIZE as follows: TYPE aType1 : ... (* whatever *) aType2 : ... (* whatever *) VAR aVar1 : aType1 ; aVar2 : aType2 ; BEGIN ... aVar2 := aType2(aVar1) ; ... For types not of the same size this doesn't work. For enumerated types, the portable thing to do is to use VAL and ORD (CHR for chars if you want). Charlie Allen cca@pur-phy