home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!sun-barr!olivea!charnel!sifon!CC.UMontreal.CA!pigeons
- From: pigeons@JSP.UMontreal.CA (Pigeon Steven)
- Newsgroups: comp.lang.pascal
- Subject: Re: untyped vars
- Message-ID: <1993Jan9.163613.19275@cc.umontreal.ca>
- Date: 9 Jan 93 16:36:13 GMT
- References: <34921@adm.brl.mil>
- Sender: news@cc.umontreal.ca (Administration de Cnews)
- Organization: Universite de Montreal
- Lines: 53
-
- In article <34921@adm.brl.mil> ATURNER@rcnvms.rcn.mass.edu (Alan Turner) writes:
- >Date sent: 1/7/93
- >
- >Hello to all,
- >
- >I am curious - TP allows for untyped vars as in parameter lists:
- >
- >ex: procedure something(a : word; b: byte; var c)
- > ^^^^^
- >I would like to know of some wonderful uses for such a thing in addition
- >to comparing the size of two variables as in TP60.man pg 107-108.
- >
- >
- >
- >-=Alan Turner=-
- >-=Email: aturner@ecn.mass.edu=-
-
-
- One "wonderful use" for untyped variables is precisely when you dont quite
- care for types. Exactly as "blockread" and "blockwrite", on which you can
- read in the manual, or to program routines that are non "type-oriented" but
- only "size" or "byte-packet" oriented. I wrote some time ago a unit for
- string management (in replacement of the system routines, copy, insert,
- delete, etc) giving a respectable improvement (sp?) of 6 to 10 times faster,
- (sorry, that's not the point) and all strings are refered as "var a;", with
- no type, thus avoiding the fallowing bug:
-
-
- type shortstring= string[40]; { say}
-
- ...
-
- var a:shortstring;
- ...
- begin
- ...
- delete(a,1,10);
- ...
- end;
- ...
-
- And getting an "type mismatch" when strict var/type option is on. You can find
- another half-a-dozen "wonderful uses" for untyped variable.
-
- Regards,
-
- S.
-
- --
- ------------------------------------------------------------
- STEVEN PIGEON, a.k.a pigeons@jsp.umontral.ca, planet Earth.
- ==Departement d'informatique et de Recherche Operationnelle=
- == Universite de Montreal==
-